------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/gxzheng/Desktop/fintech/code/../log/finreg_quantgov+stsi.log
  log type:  text
 opened on:  19 May 2023, 14:59:22

. 
. 
. **********************************
. ** Create State and CSA Regdata **
. **********************************
. 
. ** State Reg data **
. qui import delimited using "../data/State-RegData_2-1/state_regdata_industry_2-1.csv", varn(1) clear

. keep if probability == 1
(6,416,877 observations deleted)

. gen industry_two_digit = floor(industry/10)

. * NAICS code 
. * 51 - Information
. * 52 - Finance and Insurance 
. keep if industry_two_digit == 52
(1,942 observations deleted)

. tempfile state_reg_ind_fin

. save `state_reg_ind_fin'
file /var/folders/y0/7tm8swhj7q9bm8t8f8q4g_gr0000gq/T//S_52133.000002 saved as .dta format

. 
. qui import delimited using "../data/State-RegData_2-1/state_regdata_restrictions_2-1.csv", varn(1) clear

. merge 1:1 state date_collected document_id document_reference using `state_reg_ind_fin'

    Result                      Number of obs
    -----------------------------------------
    Not matched                        71,731
        from master                    71,731  (_merge==1)
        from using                          0  (_merge==2)

    Matched                               395  (_merge==3)
    -----------------------------------------

. keep if _m == 3
(71,731 observations deleted)

. drop _m 

. // save "state_regdata_industry_restriction_finance_only.dta", replace
. replace state = subinstr(state,"_"," ",.)
(87 real changes made)

. replace state = "district of columbia" if state == "dc"
(4 real changes made)

. 
. * Use statstates module -> troubleshoot @ https://kb.iu.edu/d/arur
. * set PERSONAL as the correct ado directory
. // ssc install statastates, replace
. // sysdir set PERSONAL "~/Documents/Stata/ado"
. statastates, name(state)
(395 real changes made)

    Result                      Number of obs
    -----------------------------------------
    Not matched                             6
        from master                         0  (_merge==1)
        from using                          6  (_merge==2)

    Matched                               395  (_merge==3)
    -----------------------------------------

. 
. keep if _m == 3
(6 observations deleted)

. drop _m

. // save "state_regdata_industry_restriction_finance_only.dta", replace
. gen restrict_rate = restrictions/words

. collapse (count) document_id (sum) restrictions words (mean) restrict_rate, by(state state_abbrev state_fips)

. gen tot_restrict_rate = restrictions/words

. save "../data/state_regdata_industry_restriction_finance_only_collapse.dta", replace
file ../data/state_regdata_industry_restriction_finance_only_collapse.dta saved

. 
. 
. ** CSA Reg data **
. use "../data/state_regdata_industry_restriction_finance_only_collapse.dta", clear

. merge 1:m state_fips using "../data/fipscounty_csa_crosswalk.dta"

    Result                      Number of obs
    -----------------------------------------
    Not matched                            85
        from master                         0  (_merge==1)
        from using                         85  (_merge==2)

    Matched                             1,723  (_merge==3)
    -----------------------------------------

. keep if _m == 3
(85 observations deleted)

. drop _m

. keep if missing(csacode) == 0
(619 observations deleted)

. keep state state_abbrev state_fips document_id restrictions restrict_rate tot_restrict_rate csacode 

. rename csacode csa_code

. duplicates drop

Duplicates in terms of all variables

(890 observations deleted)

. save "../data/csa_regdata_industry_restriction_finance_only_collapse.dta", replace
file ../data/csa_regdata_industry_restriction_finance_only_collapse.dta saved

. 
. 
. 
. *********************************************
. ** Functions Defining for Code Convenience **
. *********************************************
. 
. program drop _all

. 
. * define `clean_v3_7ind3app' to generate 7 industries and 3 applications in v3 data
. program clean_v3_7ind3app
  1. 
. * 7 industries
. gen bank=(primary_industry=="Diversified Banks" | primary_industry=="Regional Banks" | primary_industry=="Thrifts and 
> Mortgage Finance")
  2. gen capmkt=(primary_industry=="Asset Management and Custody Banks" | primary_industry=="Diversified Capital Markets
> " | primary_industry=="Diversified REITs" | primary_industry=="Financial Exchanges and Data" | primary_industry=="Inve
> stment Banking and Brokerage" | primary_industry=="Specialized REITs") 
  3. gen consfin=(primary_industry=="Consumer Finance" | primary_industry=="Specialized Finance")
  4. gen insur=(primary_industry=="Life and Health Insurance" | primary_industry=="Multi-line Insurance" | primary_indus
> try=="Property and Casualty Insurance" | primary_industry=="Reinsurance")
  5. gen pay=(primary_industry=="Data Processing and Outsourced Services")
  6. gen it=(primary_industry=="Application Software" | primary_industry=="Communications Equipment" | primary_industry=
> ="Consumer Electronics" | primary_industry=="Electrical Components and Equipment" | primary_industry=="Electronic Comp
> onents")
  7. replace it=1 if (primary_industry=="IT Consulting and Other Services" | primary_industry=="Electronic Equipment and
>  Instruments" | primary_industry=="Electronic Manufacturing Services" | primary_industry=="Integrated Telecommunicatio
> n Services" | primary_industry=="Interactive Media and Services")
  8. replace it=1 if (primary_industry=="Internet Services and Infrastructure" | primary_industry=="Internet and Direct 
> Marketing Retail" | primary_industry=="Semiconductor Equipment" | primary_industry=="Semiconductors" | primary_industr
> y=="Specialized Consumer Services" | primary_industry=="Systems Software")
  9. replace it=1 if (primary_industry=="Technology Distributors" | primary_industry=="Technology Hardware, Storage and 
> Peripherals" | primary_industry=="Wireless Telecommunication Services")
 10. gen otherind=(bank==0 & capmkt==0 & consfin==0 & insur==0 & it==0)
 11. gen industrytype=1 if bank==1
 12. replace industrytype=2 if capmkt==1
 13. replace industrytype=3 if consfin==1
 14. replace industrytype=4 if insur==1
 15. replace industrytype=5 if pay==1
 16. replace industrytype=6 if it==1
 17. replace industrytype=7 if industrytype==.
 18. label define industrytype1 1 "bank" 2 "capmkt" 3 "consfin" 4 "insur" 5 "payments" 6 "it" 7 "otherind" 
 19. label values industrytype industrytype1
 20. gen indsimpletype=1 if bank==1
 21. replace indsimpletype=2 if (capmkt==1 | consfin==1 | insur==1)
 22. replace indsimpletype=5 if pay==1
 23. replace indsimpletype=6 if (it==1 | industrytype==7)
 24. label define indsimpletype1 1 "Bank" 2 "Other Finance" 5 "Payments" 6 "IT and Other" 
 25. label values indsimpletype indsimpletype1
 26. 
. * 3 applications
. gen payapp=(payments>=0.5)
 27. gen bankapp=(commercial_banking+investment_banking+retail_banking>=0.5)
 28. gen otherapp=(bankapp~=1 & payapp~=1)
 29. gen apptype=1 if payapp==1
 30. replace apptype=2 if bankapp==1
 31. replace apptype=3 if apptype==.
 32. label define apptype1 1 "payments" 2 "banking" 3 "otherapp"
 33. label values apptype apptype1
 34. 
. end

. 
. * define `add_year' for later regression to display years
. program add_year
  1.         sum year if e(sample)
  2.         estadd scalar min_year = r(min)
  3.         estadd scalar max_year = r(max)
  4. end

. 
. 
. 
. 
. **************************************************************************
. ** Regulatory restrictions on financial patenting (Table 9, Figure A-8) **
. **************************************************************************
. 
. use ../data/financial_patent_data_v3.dta, clear

. clean_v3_7ind3app
(1,967 real changes made)
(1,862 real changes made)
(1,883 real changes made)
(22,654 missing values generated)
(1,618 real changes made)
(715 real changes made)
(1,098 real changes made)
(2,390 real changes made)
(9,057 real changes made)
(7,776 real changes made)
(22,654 missing values generated)
(3,431 real changes made)
(2,390 real changes made)
(16,833 real changes made)
(13,601 missing values generated)
(5,486 real changes made)
(9,924 real changes made)

. 
. ** Dropping Puerto Rican CSAs
. drop if csa_code==364
(0 observations deleted)

. drop if csa_code==434
(0 observations deleted)

. drop if csa_code==490
(2 observations deleted)

. 
. save "../data/financial_patent_data_basic_clean.dta", replace
file ../data/financial_patent_data_basic_clean.dta saved

. 
. 
. ** Benchmark
. use "../data/financial_patent_data_basic_clean.dta", clear

. collapse (count) patent_id, by(state_fips indsimpletype apptype app_year)

. drop if missing(state_fips)
(182 observations deleted)

. preserve

. collapse (sum) patent_id, by(state_fips indsimpletype apptype)

. tempfile state_app_ind_cell_0019

. save `state_app_ind_cell_0019'
file /var/folders/y0/7tm8swhj7q9bm8t8f8q4g_gr0000gq/T//S_52133.000004 saved as .dta format

. restore

. 
. collapse (sum) patent_id, by(state_fips)

. drop patent_id

. expand 4
(156 observations created)

. bysort state_fips: gen indsimpletype = _n

. replace indsimpletype = indsimpletype + 2 if indsimpletype >=3
(104 real changes made)

. label values indsimpletype indsimpletype1

. expand 3
(416 observations created)

. bysort state_fips indsimpletype: gen apptype = _n

. label values apptype apptype1

. 
. merge 1:1 state_fips indsimpletype apptype using `state_app_ind_cell_0019'
(label indsimpletype1 already defined)
(label apptype1 already defined)

    Result                      Number of obs
    -----------------------------------------
    Not matched                           209
        from master                       209  (_merge==1)
        from using                          0  (_merge==2)

    Matched                               415  (_merge==3)
    -----------------------------------------

. drop _m

. replace patent_id = 0 if missing(patent_id)
(209 real changes made)

. merge m:1 state_fips using "../data/state_regdata_industry_restriction_finance_only_collapse.dta", keep(3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                               540  (_merge==3)
    -----------------------------------------

. drop _m

. rename patent_id patcount

. gen banksame = (indsimpletype == 1 & apptype == 2)

. gen paysame = (indsimpletype == 5 & apptype == 1)

. save "../data/00_19_state_level_patent_cell_data_new_regdata.dta", replace
file ../data/00_19_state_level_patent_cell_data_new_regdata.dta saved

. 
. 
. * For 08-19 only..
. use "../data/financial_patent_data_basic_clean.dta", clear

. collapse (count) patent_id, by(state_fips indsimpletype apptype app_year)

. drop if missing(state_fips)
(182 observations deleted)

. preserve

. * generate the 08-19 sub-sample
. keep if app_year >= 2008 & app_year <= 2019
(1,502 observations deleted)

. collapse (sum) patent_id, by(state_fips indsimpletype apptype)

. tempfile state_app_ind_cell_0819

. save `state_app_ind_cell_0819'
file /var/folders/y0/7tm8swhj7q9bm8t8f8q4g_gr0000gq/T//S_52133.000006 saved as .dta format

. restore

. 
. collapse (sum) patent_id, by(state_fips)

. drop patent_id

. expand 4
(156 observations created)

. bysort state_fips: gen indsimpletype = _n

. replace indsimpletype = indsimpletype + 2 if indsimpletype >=3
(104 real changes made)

. label values indsimpletype indsimpletype1

. expand 3
(416 observations created)

. bysort state_fips indsimpletype: gen apptype = _n

. label values apptype apptype1

. 
. merge 1:1 state_fips indsimpletype apptype using `state_app_ind_cell_0819'
(label indsimpletype1 already defined)
(label apptype1 already defined)

    Result                      Number of obs
    -----------------------------------------
    Not matched                           240
        from master                       240  (_merge==1)
        from using                          0  (_merge==2)

    Matched                               384  (_merge==3)
    -----------------------------------------

. drop _m

. replace patent_id = 0 if missing(patent_id)
(240 real changes made)

. merge m:1 state_fips using "../data/state_regdata_industry_restriction_finance_only_collapse.dta", keep(3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                               540  (_merge==3)
    -----------------------------------------

. drop _m

. rename patent_id patcount

. gen banksame = (indsimpletype == 1 & apptype == 2)

. gen paysame = (indsimpletype == 5 & apptype == 1)

. save "../data/08_19_state_level_patent_cell_data_new_regdata.dta", replace
file ../data/08_19_state_level_patent_cell_data_new_regdata.dta saved

. 
. 
. * For consumer-only..
. use "../data/financial_patent_data_basic_clean.dta", clear

. merge m:1 patent_id using "../data/consumer.dta"

    Result                      Number of obs
    -----------------------------------------
    Not matched                             2
        from master                         0  (_merge==1)
        from using                          2  (_merge==2)

    Matched                            24,253  (_merge==3)
    -----------------------------------------

. sum Top100_Keywords

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
Top100_Key~s |     24,255    .2420532    .5569677          0          7

. drop _merge

. keep if consumer == 1
(12,101 observations deleted)

. 
. collapse (count) patent_id, by(state_fips indsimpletype apptype app_year)

. drop if missing(state_fips)
(153 observations deleted)

. preserve

. collapse (sum) patent_id, by(state_fips indsimpletype apptype)

. tempfile state_app_ind_cell_0019consumer

. save `state_app_ind_cell_0019consumer'
file /var/folders/y0/7tm8swhj7q9bm8t8f8q4g_gr0000gq/T//S_52133.000008 saved as .dta format

. 
. restore

. collapse (sum) patent_id, by(state_fips)

. drop patent_id

. expand 4
(150 observations created)

. bysort state_fips: gen indsimpletype = _n

. replace indsimpletype = indsimpletype + 2 if indsimpletype >=3
(100 real changes made)

. label values indsimpletype indsimpletype1

. expand 3
(400 observations created)

. bysort state_fips indsimpletype: gen apptype = _n

. label values apptype apptype1

. 
. merge 1:1 state_fips indsimpletype apptype using  `state_app_ind_cell_0019consumer'
(label apptype1 already defined)
(label indsimpletype1 already defined)

    Result                      Number of obs
    -----------------------------------------
    Not matched                           228
        from master                       228  (_merge==1)
        from using                          0  (_merge==2)

    Matched                               372  (_merge==3)
    -----------------------------------------

. drop _m

. replace patent_id = 0 if missing(patent_id)
(228 real changes made)

. merge m:1 state_fips using "../data/state_regdata_industry_restriction_finance_only_collapse.dta", keep(3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                               528  (_merge==3)
    -----------------------------------------

. drop _m

. rename patent_id patcount

. gen banksame = (indsimpletype == 1 & apptype == 2)

. gen paysame = (indsimpletype == 5 & apptype == 1)

. save "../data/00_19_state_level_patent_cell_data_new_regdata_consumer.dta", replace
file ../data/00_19_state_level_patent_cell_data_new_regdata_consumer.dta saved

. 
. 
. 
. **** Table 9 ****
. * Benchmark OLS
. use "../data/00_19_state_level_patent_cell_data_new_regdata.dta", clear

. replace restrictions = restrictions/100
(540 real changes made)

. reghdfe patcount c.restrictions##(b6.indsimpletype b1.apptype), a(state_fips) vce(cluster state_fips)
note: restrictions is probably collinear with the fixed effects (all partialled-out values are close to zero; tol = 1.0e
> -09)
(MWFE estimator converged in 1 iterations)
note: restrictions omitted because of collinearity

HDFE Linear regression                            Number of obs   =        540
Absorbing 1 HDFE group                            F(  10,     44) =      33.35
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.7330
                                                  Adj R-squared   =     0.7033
                                                  Within R-sq.    =     0.5805
Number of clusters (state_fips) =         45      Root MSE        =    55.2083

                                            (Std. err. adjusted for 45 clusters in state_fips)
----------------------------------------------------------------------------------------------
                             |               Robust
                    patcount | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------------------+----------------------------------------------------------------
                restrictions |          0  (omitted)
                             |
               indsimpletype |
                       Bank  |    44.6492   25.64316     1.74   0.089    -7.031206     96.3296
              Other Finance  |   36.07609    30.8463     1.17   0.248    -26.09055    98.24272
                   Payments  |   22.42141   15.35949     1.46   0.151    -8.533597    53.37642
                             |
                     apptype |
                    banking  |    9.18955    11.4521     0.80   0.427    -13.89064    32.26974
                   otherapp  |  -2.213378   1.452599    -1.52   0.135    -5.140898    .7141427
                             |
indsimpletype#c.restrictions |
                       Bank  |  -12.62182   3.464006    -3.64   0.001    -19.60306   -5.640572
              Other Finance  |  -10.73705   4.360666    -2.46   0.018    -19.52539     -1.9487
                   Payments  |  -9.789794   1.913084    -5.12   0.000    -13.64536   -5.934227
                             |
      apptype#c.restrictions |
                    banking  |  -2.370394   1.662512    -1.43   0.161    -5.720968    .9801796
                   otherapp  |   .4796052   .0907865     5.28   0.000     .2966369    .6625735
                             |
                       _cons |    88.5537   10.64564     8.32   0.000     67.09884    110.0086
----------------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
  state_fips |        45          45           0    *|
-----------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

. 
. * F-test for coefficients equality
. test c.restrictions#1.indsimpletype == c.restrictions#6.indsimpletype

 ( 1)  1.indsimpletype#c.restrictions - 6b.indsimpletype#co.restrictions = 0

       F(  1,    44) =   13.28
            Prob > F =    0.0007

. local F1 = r(F)

. test c.restrictions#2.indsimpletype == c.restrictions#6.indsimpletype

 ( 1)  2.indsimpletype#c.restrictions - 6b.indsimpletype#co.restrictions = 0

       F(  1,    44) =    6.06
            Prob > F =    0.0178

. local F2 = r(F)

. test c.restrictions#5.indsimpletype == c.restrictions#6.indsimpletype

 ( 1)  5.indsimpletype#c.restrictions - 6b.indsimpletype#co.restrictions = 0

       F(  1,    44) =   26.19
            Prob > F =    0.0000

. local F3 = r(F)

. test c.restrictions#2.apptype == c.restrictions#1.apptype

 ( 1)  - 1b.apptype#co.restrictions + 2.apptype#c.restrictions = 0

       F(  1,    44) =    2.03
            Prob > F =    0.1610

. local F4 = r(F)

. 
. outreg2 using "../Charts/Table_9_RegulationRestrictions.xls", replace nocon label bracket se bdec(3) sdec(3) ///
>         keep(1.indsimpletype#c.restrictions 2.indsimpletype#c.restrictions 5.indsimpletype#c.restrictions 2.apptype#c.
> restrictions) ///
>         addtext(State FE, Yes, PatentType FEs, Yes, AssigneeIndustry FEs, Yes, DataSample, All Patents, DataSamplePeri
> od, 2000-2018) /// 
>         addstat(Interaction with Bank vs. IT/Other, `F1', Interaction with Other Finance vs. IT/Other, `F2', Interacti
> on with Payments vs.IT/Other, `F3', Interaction with Banking vs. Payment Type, `F4')
../Charts/Table_9_RegulationRestrictions.xls
dir : seeout

. 
. 
. * 08-18 OLS
. use "../data/08_19_state_level_patent_cell_data_new_regdata.dta", clear

. replace restrictions = restrictions/100
(540 real changes made)

. reghdfe patcount c.restrictions##(b6.indsimpletype b1.apptype), a(state_fips) vce(cluster state_fips)
note: restrictions is probably collinear with the fixed effects (all partialled-out values are close to zero; tol = 1.0e
> -09)
(MWFE estimator converged in 1 iterations)
note: restrictions omitted because of collinearity

HDFE Linear regression                            Number of obs   =        540
Absorbing 1 HDFE group                            F(  10,     44) =      21.42
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.7115
                                                  Adj R-squared   =     0.6794
                                                  Within R-sq.    =     0.5320
Number of clusters (state_fips) =         45      Root MSE        =    37.0834

                                            (Std. err. adjusted for 45 clusters in state_fips)
----------------------------------------------------------------------------------------------
                             |               Robust
                    patcount | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------------------+----------------------------------------------------------------
                restrictions |          0  (omitted)
                             |
               indsimpletype |
                       Bank  |    31.2301   17.12913     1.82   0.075    -3.291388    65.75159
              Other Finance  |   25.63411   20.44075     1.25   0.216    -15.56151    66.82973
                   Payments  |    11.6412   8.139424     1.43   0.160    -4.762734    28.04513
                             |
                     apptype |
                    banking  |   8.058581   8.697668     0.93   0.359    -9.470417    25.58758
                   otherapp  |  -1.226153   .8656663    -1.42   0.164    -2.970788    .5184831
                             |
indsimpletype#c.restrictions |
                       Bank  |  -7.779032    2.31961    -3.35   0.002     -12.4539   -3.104164
              Other Finance  |  -6.714725   2.895424    -2.32   0.025    -12.55007   -.8793814
                   Payments  |  -5.346872   .9941758    -5.38   0.000    -7.350501   -3.343242
                             |
      apptype#c.restrictions |
                    banking  |   -1.93427   1.259918    -1.54   0.132    -4.473468    .6049287
                   otherapp  |   .1093632   .0515573     2.12   0.040     .0054562    .2132702
                             |
                       _cons |   53.17222   6.814947     7.80   0.000      39.4376    66.90685
----------------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
  state_fips |        45          45           0    *|
-----------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

. 
. * F-test for coefficients equality
. test c.restrictions#1.indsimpletype == c.restrictions#6.indsimpletype

 ( 1)  1.indsimpletype#c.restrictions - 6b.indsimpletype#co.restrictions = 0

       F(  1,    44) =   11.25
            Prob > F =    0.0016

. local F1 = r(F)

. test c.restrictions#2.indsimpletype == c.restrictions#6.indsimpletype

 ( 1)  2.indsimpletype#c.restrictions - 6b.indsimpletype#co.restrictions = 0

       F(  1,    44) =    5.38
            Prob > F =    0.0251

. local F2 = r(F)

. test c.restrictions#5.indsimpletype == c.restrictions#6.indsimpletype

 ( 1)  5.indsimpletype#c.restrictions - 6b.indsimpletype#co.restrictions = 0

       F(  1,    44) =   28.92
            Prob > F =    0.0000

. local F3 = r(F)

. test c.restrictions#2.apptype == c.restrictions#1.apptype

 ( 1)  - 1b.apptype#co.restrictions + 2.apptype#c.restrictions = 0

       F(  1,    44) =    2.36
            Prob > F =    0.1319

. local F4 = r(F)

. 
. outreg2 using "../Charts/Table_9_RegulationRestrictions.xls", append nocon label bracket se bdec(3) sdec(3)  ///
>         keep(1.indsimpletype#c.restrictions 2.indsimpletype#c.restrictions 5.indsimpletype#c.restrictions 2.apptype#c.
> restrictions) ///
>         addtext(State FE, Yes, PatentType FEs, Yes, AssigneeIndustry FEs, Yes, DataSample, All Patents, DataSamplePeri
> od, 2008-2018) /// 
>         addstat(Interaction with Bank vs. IT/Other, `F1', Interaction with Other Finance vs. IT/Other, `F2', Interacti
> on with Payments vs.IT/Other, `F3', Interaction with Banking vs. Payment Type, `F4')
../Charts/Table_9_RegulationRestrictions.xls
dir : seeout

. 
.         
. 
. * Consumer only OLS
. use "../data/00_19_state_level_patent_cell_data_new_regdata_consumer.dta", clear

. replace restrictions = restrictions/100
(528 real changes made)

. reghdfe patcount c.restrictions##(b6.indsimpletype b1.apptype), a(state_fips) vce(cluster state_fips)
note: restrictions is probably collinear with the fixed effects (all partialled-out values are close to zero; tol = 1.0e
> -09)
(MWFE estimator converged in 1 iterations)
note: restrictions omitted because of collinearity

HDFE Linear regression                            Number of obs   =        528
Absorbing 1 HDFE group                            F(  10,     43) =      12.75
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.7005
                                                  Adj R-squared   =     0.6670
                                                  Within R-sq.    =     0.5228
Number of clusters (state_fips) =         44      Root MSE        =    29.4278

                                            (Std. err. adjusted for 44 clusters in state_fips)
----------------------------------------------------------------------------------------------
                             |               Robust
                    patcount | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-----------------------------+----------------------------------------------------------------
                restrictions |          0  (omitted)
                             |
               indsimpletype |
                       Bank  |   18.69753   13.87273     1.35   0.185    -9.279491    46.67456
              Other Finance  |    15.8329   16.00477     0.99   0.328    -16.44379    48.10959
                   Payments  |   4.514035    7.43649     0.61   0.547    -10.48308    19.51115
                             |
                     apptype |
                    banking  |   6.749308   5.994619     1.13   0.266    -5.339992    18.83861
                   otherapp  |  -.9907095   1.253252    -0.79   0.434    -3.518134    1.536715
                             |
indsimpletype#c.restrictions |
                       Bank  |   -5.66198   1.858926    -3.05   0.004    -9.410862   -1.913098
              Other Finance  |  -5.050436   2.230771    -2.26   0.029    -9.549215   -.5516575
                   Payments  |  -3.846371   .8976306    -4.29   0.000    -5.656616   -2.036126
                             |
      apptype#c.restrictions |
                    banking  |  -1.847824    .821828    -2.25   0.030    -3.505198   -.1904494
                   otherapp  |  -.2034014   .0732928    -2.78   0.008    -.3512104   -.0555923
                             |
                       _cons |   46.89773   5.942446     7.89   0.000     34.91364    58.88181
----------------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
  state_fips |        44          44           0    *|
-----------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

. 
. * F-test for coefficients equality
. test c.restrictions#1.indsimpletype == c.restrictions#6.indsimpletype

 ( 1)  1.indsimpletype#c.restrictions - 6b.indsimpletype#co.restrictions = 0

       F(  1,    43) =    9.28
            Prob > F =    0.0040

. local F1 = r(F)

. test c.restrictions#2.indsimpletype == c.restrictions#6.indsimpletype

 ( 1)  2.indsimpletype#c.restrictions - 6b.indsimpletype#co.restrictions = 0

       F(  1,    43) =    5.13
            Prob > F =    0.0287

. local F2 = r(F)

. test c.restrictions#5.indsimpletype == c.restrictions#6.indsimpletype

 ( 1)  5.indsimpletype#c.restrictions - 6b.indsimpletype#co.restrictions = 0

       F(  1,    43) =   18.36
            Prob > F =    0.0001

. local F3 = r(F)

. test c.restrictions#2.apptype == c.restrictions#1.apptype

 ( 1)  - 1b.apptype#co.restrictions + 2.apptype#c.restrictions = 0

       F(  1,    43) =    5.06
            Prob > F =    0.0297

. local F4 = r(F)

. 
. outreg2 using "../Charts/Table_9_RegulationRestrictions.xls", append nocon label bracket se bdec(3) sdec(3)  ///
>         keep(1.indsimpletype#c.restrictions 2.indsimpletype#c.restrictions 5.indsimpletype#c.restrictions 2.apptype#c.
> restrictions) ///
>         addtext(State FE, Yes, PatentType FEs, Yes, AssigneeIndustry FEs, Yes, DataSample, Consumer-Only, DataSamplePe
> riod, 2000-2018) /// 
>         addstat(Interaction with Bank vs. IT/Other, `F1', Interaction with Other Finance vs. IT/Other, `F2', Interacti
> on with Payments vs.IT/Other, `F3', Interaction with Banking vs. Payment Type, `F4')
../Charts/Table_9_RegulationRestrictions.xls
dir : seeout

. 
. 
. 
. 
. ***** Figure A8 *****
. * Figure A-8 panel A
. use "../data/00_19_state_level_patent_cell_data_new_regdata.dta", clear

. replace restrictions = restrictions/100
(540 real changes made)

. 
. preserve

. collapse (sum) patcount (min) restriction, by(state_fips indsimpletype)

. reshape wide patcount, i(state_fips) j(indsimpletype)
(j = 1 2 5 6)

Data                               Long   ->   Wide
-----------------------------------------------------------------------------
Number of observations              180   ->   45          
Number of variables                   4   ->   6           
j variable (4 values)     indsimpletype   ->   (dropped)
xij variables:
                               patcount   ->   patcount1 patcount2 ... patcount6
-----------------------------------------------------------------------------

. drop if patcount1 == 0 & patcount6 == 0
(0 observations deleted)

. gen patent_total = patcount1 + patcount2 + patcount5 + patcount6

. gen share_bank = patcount1/patent_total

. 
. graph twoway (lfitci share_bank restrictions if share_bank!=0 , clc(red) leg(off)) (scatter share_bank restrictions if
>  share_bank!=0, mc(navy) msize(small)), ///
> xtitle("State-level Regulatory Restrictions", size(small)) xlabel(,labsize(small)) ///
> ytitle("Share of Finance Patents by Banks(2000-2018)", size(small)) ylabel(-0.2(0.2)1,labsize(small)) note("Note: The 
> regulatory strictions in a given state is measured by the total number of restriction-related words(in hundreds) provi
> ded " "by QuantGov's RegData.", size(vsmall)) ///
> graphregion(color(white))

. graph export "../Charts/Figure_A8A.png", replace
file /Users/gxzheng/Desktop/fintech/code/../Charts/Figure_A8A.png saved as PNG format

. restore 

. 
. 
. * Figure A-8 panel B
. use "../data/08_19_state_level_patent_cell_data_new_regdata.dta", clear

. replace restrictions = restrictions/100
(540 real changes made)

. preserve

. collapse (sum) patcount (min) restriction, by(state_fips indsimpletype)

. reshape wide patcount, i(state_fips) j(indsimpletype)
(j = 1 2 5 6)

Data                               Long   ->   Wide
-----------------------------------------------------------------------------
Number of observations              180   ->   45          
Number of variables                   4   ->   6           
j variable (4 values)     indsimpletype   ->   (dropped)
xij variables:
                               patcount   ->   patcount1 patcount2 ... patcount6
-----------------------------------------------------------------------------

. drop if patcount1 == 0 & patcount6 == 0
(0 observations deleted)

. gen patent_total = patcount1 + patcount2 + patcount5 + patcount6

. gen share_bank = patcount1/patent_total

. 
. graph twoway (lfitci share_bank restrictions if share_bank!=0 , clc(red) leg(off)) (scatter share_bank restrictions if
>  share_bank!=0, mc(navy) msize(small)), ///
> xtitle("State-level Regulatory Restrictions", size(small)) xlabel(,labsize(small)) ///
> ytitle("Share of Finance Patents by Banks(2008-2018)", size(small)) ylabel(-0.2(0.2)1,labsize(small)) note("Note: The 
> regulatory strictions in a given state is measured by the total number of restriction-related words(in hundreds) provi
> ded " "by QuantGov's RegData.", size(vsmall)) ///
> graphregion(color(white))

. graph export "../Charts/Figure_A8B.png", replace
file /Users/gxzheng/Desktop/fintech/code/../Charts/Figure_A8B.png saved as PNG format

. restore

. 
. * Figure A-8 panel C
. use "../data/00_19_state_level_patent_cell_data_new_regdata_consumer.dta", clear

. replace restrictions = restrictions/100
(528 real changes made)

. preserve

. collapse (sum) patcount (min) restriction, by(state_fips indsimpletype)

. reshape wide patcount, i(state_fips) j(indsimpletype)
(j = 1 2 5 6)

Data                               Long   ->   Wide
-----------------------------------------------------------------------------
Number of observations              176   ->   44          
Number of variables                   4   ->   6           
j variable (4 values)     indsimpletype   ->   (dropped)
xij variables:
                               patcount   ->   patcount1 patcount2 ... patcount6
-----------------------------------------------------------------------------

. drop if patcount1 == 0 & patcount6 == 0
(0 observations deleted)

. gen patent_total = patcount1 + patcount2 + patcount5 + patcount6

. gen share_bank = patcount1/patent_total

. 
. graph twoway (lfitci share_bank restrictions if share_bank!=0 , clc(red) leg(off)) (scatter share_bank restrictions if
>  share_bank!=0, mc(navy) msize(small)), ///
> xtitle("State-level Regulatory Restrictions", size(small)) xlabel(,labsize(small)) ///
> ytitle("Share of Finance Patents(Consumer-only) by Banks(2000-2018)", size(small)) ylabel(-0.2(0.2)1,labsize(small)) n
> ote("Note: The regulatory strictions in a given state is measured by the total number of restriction-related words(in 
> hundreds) provided " "by QuantGov's RegData.", size(vsmall)) ///
> graphregion(color(white))

. graph export "../Charts/Figure_A8C.png", replace
file /Users/gxzheng/Desktop/fintech/code/../Charts/Figure_A8C.png saved as PNG format

. restore

. 
. 
. 
. 
. 
. *********************************************************
. ** Shifting location on financial patenting (Table 11) **
. *********************************************************
. 
. **** Shifting innovative location and regulatory pressure ****
. **** Table 11 Panel A ****
. 
. use ../data/financial_patent_data_v3.dta, clear

. clean_v3_7ind3app
(1,967 real changes made)
(1,862 real changes made)
(1,883 real changes made)
(22,654 missing values generated)
(1,618 real changes made)
(715 real changes made)
(1,098 real changes made)
(2,390 real changes made)
(9,057 real changes made)
(7,776 real changes made)
(22,654 missing values generated)
(3,431 real changes made)
(2,390 real changes made)
(16,833 real changes made)
(13,601 missing values generated)
(5,486 real changes made)
(9,924 real changes made)

. 
. * 2 geographies
. gen us=(inventor_1_country=="US")

. gen othernation=(us==0)

. gen nationtype=1 if us==1
(5,103 missing values generated)

. replace nationtype=2 if nationtype==.
(5,103 real changes made)

. label define nationtype1 1 "us" 2 "not us"

. label values nationtype nationtype1 

. save "../data/financial_patent_data_basic_clean_with_geo.dta", replace 
file ../data/financial_patent_data_basic_clean_with_geo.dta saved

. 
. 
. * Generate the sample containing all financial patents
. use "../data/financial_patent_data_basic_clean_with_geo.dta", clear

. drop if us != 1
(5,103 observations deleted)

. 
. by company_name app_year, sort: egen modalcsa=mode(csa_code), max
Warning: at least one group contains all missing values or contains multiple modes.  Generating missing values for the
mode of these groups.  Use the missing, maxmode, minmode, or nummode() options to control this behavior.
(1,017 missing values generated)

. by company_name app_year, sort: egen modalstate = mode(state_fips), max
Warning: at least one group contains all missing values or contains multiple modes.  Generating missing values for the
mode of these groups.  Use the missing, maxmode, minmode, or nummode() options to control this behavior.
(1 missing value generated)

. collapse (count) patent_id, by(company_name indsimpletype modalcsa modalstate app_year)

. drop if missing(company_name)
(19 observations deleted)

. 
. bysort company_name: egen first_year = min(app_year)

. bysort company_name: egen last_year = max(app_year)

. keep if first_year <2008 & last_year >=2015
(3,419 observations deleted)

. bysort company_name: egen patcount_pre2008 = sum(patent_id) if app_year <2008
(794 missing values generated)

. gen app_period = 2008 if app_year < 2008
(794 missing values generated)

. replace app_period  = 2015 if app_year >=2008
(794 real changes made)

. by company_name app_period, sort: egen csa_modal = mode(modalcsa), max
Warning: at least one group contains all missing values or contains multiple modes.  Generating missing values for the
mode of these groups.  Use the missing, maxmode, minmode, or nummode() options to control this behavior.
(56 missing values generated)

. by company_name app_period, sort: egen state_modal = mode(modalstate), max

. 
. gen earlymodalcsa = csa_modal if app_period == 2008
(822 missing values generated)

. gen earlymodalstate = state_modal if app_period == 2008
(794 missing values generated)

. gen latemodalcsa = csa_modal if app_period == 2015
(524 missing values generated)

. gen latemodalstate = state_modal if app_period == 2015
(496 missing values generated)

. 
. collapse (sum) patent_id (max) first_year last_year earlymodalcsa earlymodalstate latemodalcsa latemodalstate patcount
> _pre2008, by(company_name indsimpletype)

. rename (earlymodalcsa earlymodalstate) (csa_code state_fips)

. merge m:1 csa_code state_fips using "../data/csa_regdata_industry_restriction_finance_only_collapse.dta", keep(1 3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                            30
        from master                        30  (_merge==1)
        from using                          0  (_merge==2)

    Matched                                95  (_merge==3)
    -----------------------------------------

. drop _m

. rename restrictions restrictions_early

. rename (csa_code state_fips) (earlymodalcsa earlymodalstate)

. 
. merge 1:1 company_name using "../data/company_more_information.dta", keep(1 3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                               125  (_merge==3)
    -----------------------------------------

. drop _m

. gen switch_1 = (earlymodalcsa != latemodalcsa) & (earlymodalcsa != . & latemodalcsa !=.)

. gen switch_2 = (earlymodalstate != latemodalstate) & (earlymodalstate != . & latemodalstate !=.)

. gen bank = (indsimpletype == 1)

. gen capmkt = (indsimpletype == 2)

. gen pay = (indsimpletype == 5)

. gen it = (indsimpletype == 6)

. rename (latemodalcsa latemodalstate) (csa_code state_fips)

. merge m:1 csa_code state_fips using "../data/csa_regdata_industry_restriction_finance_only_collapse.dta", keep(1 3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                            30
        from master                        30  (_merge==1)
        from using                          0  (_merge==2)

    Matched                                95  (_merge==3)
    -----------------------------------------

. drop _m

. rename restrictions restrictions_late

. rename (csa_code state_fips) (latemodalcsa latemodalstate)

. 
. 
. * Create interaction variables
. replace restrictions_early = restrictions_early/100
(95 real changes made)

. replace restrictions_late = restrictions_late/100
(95 real changes made)

. gen bank_restriction_early = bank#c.restrictions_early
(30 missing values generated)

. gen pay_restriction_early = pay#c.restrictions_early
(30 missing values generated)

. gen it_restriction_early = it#c.restrictions_early
(30 missing values generated)

. gen capmkt_restriction_early = capmkt#c.restrictions_early
(30 missing values generated)

. 
. encode company_name, gen (company_name_id)

. 
. save "../data/finregswitch_csastate_pairs_company_level.dta", replace
file ../data/finregswitch_csastate_pairs_company_level.dta saved

. 
. 
. 
. 
. * Generate the sample containing the consumer-only financial patents
. use "../data/financial_patent_data_basic_clean_with_geo.dta", clear

. merge m:1 patent_id using "../data/consumer.dta"

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                            24,255  (_merge==3)
    -----------------------------------------

. sum Top100_Keywords

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
Top100_Key~s |     24,255    .2420532    .5569677          0          7

. drop _merge

. keep if consumer == 1
(12,101 observations deleted)

. 
. drop if us != 1
(2,413 observations deleted)

. 
. by company_name app_year, sort: egen modalcsa=mode(csa_code), max
Warning: at least one group contains all missing values or contains multiple modes.  Generating missing values for the
mode of these groups.  Use the missing, maxmode, minmode, or nummode() options to control this behavior.
(596 missing values generated)

. by company_name app_year, sort: egen modalstate = mode(state_fips), max

. collapse (count) patent_id, by(company_name indsimpletype modalcsa modalstate app_year)

. drop if missing(company_name)
(19 observations deleted)

. 
. bysort company_name: egen first_year = min(app_year)

. bysort company_name: egen last_year = max(app_year)

. 
. keep if first_year <2008 & last_year >=2015
(2,107 observations deleted)

. bysort company_name: egen patcount_pre2008 = sum(patent_id) if app_year <2008
(465 missing values generated)

. 
. 
. gen app_period = 2008 if app_year < 2008
(465 missing values generated)

. replace app_period  = 2015 if app_year >=2008
(465 real changes made)

. by company_name app_period, sort: egen csa_modal = mode(modalcsa), max
Warning: at least one group contains all missing values or contains multiple modes.  Generating missing values for the
mode of these groups.  Use the missing, maxmode, minmode, or nummode() options to control this behavior.
(21 missing values generated)

. by company_name app_period, sort: egen state_modal = mode(modalstate), max

. gen earlymodalcsa = csa_modal if app_period == 2008
(480 missing values generated)

. gen earlymodalstate = state_modal if app_period == 2008
(465 missing values generated)

. gen latemodalcsa = csa_modal if app_period == 2015
(285 missing values generated)

. gen latemodalstate = state_modal if app_period == 2015
(279 missing values generated)

. 
. collapse (sum) patent_id (max) first_year last_year earlymodalcsa earlymodalstate latemodalcsa latemodalstate patcount
> _pre2008, by(company_name indsimpletype)

. rename (earlymodalcsa earlymodalstate) (csa_code state_fips)

. merge m:1 csa_code state_fips using "../data/csa_regdata_industry_restriction_finance_only_collapse.dta", keep(1 3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                            19
        from master                        19  (_merge==1)
        from using                          0  (_merge==2)

    Matched                                59  (_merge==3)
    -----------------------------------------

. drop _m

. rename restrictions restrictions_early

. rename (csa_code state_fips) (earlymodalcsa earlymodalstate)

. 
. merge 1:1 company_name using "../data/company_more_information.dta", keep(1 3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                                78  (_merge==3)
    -----------------------------------------

. drop _m

. gen switch_1 = (earlymodalcsa != latemodalcsa) & (earlymodalcsa != . & latemodalcsa !=.)

. gen switch_2 = (earlymodalstate != latemodalstate) & (earlymodalstate != . & latemodalstate !=.)

. gen bank = (indsimpletype == 1)

. gen capmkt = (indsimpletype == 2)

. gen pay = (indsimpletype == 5)

. gen it = (indsimpletype == 6)

. 
. rename (latemodalcsa latemodalstate) (csa_code state_fips)

. merge m:1 csa_code state_fips using "../data/csa_regdata_industry_restriction_finance_only_collapse.dta", keep(1 3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                            14
        from master                        14  (_merge==1)
        from using                          0  (_merge==2)

    Matched                                64  (_merge==3)
    -----------------------------------------

. drop _m

. rename restrictions restrictions_late

. rename (csa_code state_fips) (latemodalcsa latemodalstate)

. 
. * Create interaction variables
. replace restrictions_early = restrictions_early/100
(59 real changes made)

. replace restrictions_late = restrictions_late/100
(64 real changes made)

. gen bank_restriction_early = bank#c.restrictions_early
(19 missing values generated)

. gen pay_restriction_early = pay#c.restrictions_early
(19 missing values generated)

. gen it_restriction_early = it#c.restrictions_early
(19 missing values generated)

. gen capmkt_restriction_early = capmkt#c.restrictions_early
(19 missing values generated)

. 
. encode company_name, gen (company_name_id)

. 
. save "../data/finregswitch_csastate_pairs_company_level_consumer_only.dta",replace
file ../data/finregswitch_csastate_pairs_company_level_consumer_only.dta saved

. 
. 
. 
. ** Regression for Table 11A **
. 
. use "../data/finregswitch_csastate_pairs_company_level.dta", clear

. 
. * Column 1 (with firm FE)
. 
. probit switch_2 restrictions_early bank bank_restriction_early capmkt capmkt_restriction_early it it_restriction_early
>  pay pay_restriction_early vc_backed public Sum2000FinVC company_name_id [weight=patcount_pre2008], vce(r)
(frequency weights assumed)

note: pay omitted because of collinearity.
note: pay_restriction_early omitted because of collinearity.
Iteration 0:   log pseudolikelihood =  -1444.385  
Iteration 1:   log pseudolikelihood = -902.88067  
Iteration 2:   log pseudolikelihood = -886.82161  
Iteration 3:   log pseudolikelihood = -884.62424  
Iteration 4:   log pseudolikelihood = -883.91525  
Iteration 5:   log pseudolikelihood = -883.76794  
Iteration 6:   log pseudolikelihood = -883.74976  
Iteration 7:   log pseudolikelihood = -883.74808  
Iteration 8:   log pseudolikelihood = -883.74807  

Probit regression                                     Number of obs =    2,554
                                                      Wald chi2(11) = 25280.82
                                                      Prob > chi2   =   0.0000
Log pseudolikelihood = -883.74807                     Pseudo R2     =   0.3881

------------------------------------------------------------------------------------------
                         |               Robust
                switch_2 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
      restrictions_early |  -.0464002   .0043473   -10.67   0.000    -.0549209   -.0378796
                    bank |  -13.39638   .8151462   -16.43   0.000    -14.99404   -11.79873
  bank_restriction_early |   .2251116   .0220939    10.19   0.000     .1818084    .2684148
                  capmkt |  -1.843779   .1952755    -9.44   0.000    -2.226512   -1.461046
capmkt_restriction_early |   .0729778   .0067188    10.86   0.000     .0598092    .0861464
                      it |  -2.588142   .1889515   -13.70   0.000     -2.95848   -2.217803
    it_restriction_early |   .0391667   .0050118     7.81   0.000     .0293437    .0489898
                     pay |          0  (omitted)
   pay_restriction_early |          0  (omitted)
               vc_backed |   .7228849   .4133661     1.75   0.080    -.0872977    1.533068
                  public |   .3790225   .1493313     2.54   0.011     .0863385    .6717065
            Sum2000FinVC |   .0001598   .0002216     0.72   0.471    -.0002745     .000594
         company_name_id |  -.0036378    .001345    -2.70   0.007     -.006274   -.0010017
                   _cons |   1.310019   .1875756     6.98   0.000     .9423774     1.67766
------------------------------------------------------------------------------------------
Note: 109 failures and 0 successes completely determined.

. local num_obs = _N

. local w_obs = e(N)

. local pR2 = e(r2_p)

. local WaldChi = e(chi2)

. local WaldChi_p = e(p)

. * Calculate margin effects
. margins, dydx(bank bank_restriction_early capmkt_restriction_early it_restriction_early pay_restriction_early) post

Average marginal effects                                 Number of obs = 2,554
Model VCE: Robust

Expression: Pr(switch_2), predict()
dy/dx wrt:  bank bank_restriction_early capmkt_restriction_early it_restriction_early pay_restriction_early

------------------------------------------------------------------------------------------
                         |            Delta-method
                         |      dy/dx   std. err.      z    P>|z|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
                    bank |  -2.561289    .180436   -14.19   0.000    -2.914938   -2.207641
  bank_restriction_early |   .0430397   .0045241     9.51   0.000     .0341725    .0519068
capmkt_restriction_early |   .0139528   .0012384    11.27   0.000     .0115256      .01638
    it_restriction_early |   .0074884   .0009478     7.90   0.000     .0056306    .0093461
   pay_restriction_early |          0  (omitted)
------------------------------------------------------------------------------------------

. * Chi-square Test for marginal effects
. test bank_restriction_early == capmkt_restriction_early

 ( 1)  bank_restriction_early - capmkt_restriction_early = 0

           chi2(  1) =   38.50
         Prob > chi2 =    0.0000

. local C1 = r(chi2)

. test bank_restriction_early  == pay_restriction_early

 ( 1)  bank_restriction_early - o.pay_restriction_early = 0

           chi2(  1) =   90.50
         Prob > chi2 =    0.0000

. local C2 = r(chi2)

. test bank_restriction_early  == it_restriction_early

 ( 1)  bank_restriction_early - it_restriction_early = 0

           chi2(  1) =   66.12
         Prob > chi2 =    0.0000

. local C3 = r(chi2)

. 
. outreg2 using "../Charts/Table_11A_ShiftLocation_RegPressure.xls", replace nocon label bracket se bdec(3) sdec(3) noob
> s ///
>         keep(bank_restriction_early) ///
>         addtext(Assignee industry FEs, Yes, Assignee characteristics controls, Yes, Firm FEs, Yes, Patent Sample, All 
> patent) /// 
>         addstat(Number of Observations, `num_obs', Weighted Observations, `w_obs', Pseudo R-squared, `pR2', Chi-square
> d, `WaldChi', p-value, `WaldChi_p', Interaction with Other Finance vs. Bank, `C1', Interaction with Payments vs. Bank,
>  `C2', Interaction with IT/Other vs. Bank, `C3')
../Charts/Table_11A_ShiftLocation_RegPressure.xls
dir : seeout

. 
. 
. * Column 2 (without firm FE)
. probit switch_2 restrictions_early bank bank_restriction_early capmkt capmkt_restriction_early it it_restriction_early
>  pay pay_restriction_early vc_backed public Sum2000FinVC [weight=patcount_pre2008], vce(r)
(frequency weights assumed)

note: pay omitted because of collinearity.
note: pay_restriction_early omitted because of collinearity.
Iteration 0:   log pseudolikelihood =  -1444.385  
Iteration 1:   log pseudolikelihood = -905.53282  
Iteration 2:   log pseudolikelihood = -891.46122  
Iteration 3:   log pseudolikelihood = -889.44098  
Iteration 4:   log pseudolikelihood = -888.87815  
Iteration 5:   log pseudolikelihood = -888.75809  
Iteration 6:   log pseudolikelihood = -888.73502  
Iteration 7:   log pseudolikelihood = -888.73004  
Iteration 8:   log pseudolikelihood = -888.72925  
Iteration 9:   log pseudolikelihood = -888.72914  
Iteration 10:  log pseudolikelihood = -888.72911  

Probit regression                                     Number of obs =    2,554
                                                      Wald chi2(10) = 19973.36
                                                      Prob > chi2   =   0.0000
Log pseudolikelihood = -888.72911                     Pseudo R2     =   0.3847

------------------------------------------------------------------------------------------
                         |               Robust
                switch_2 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
      restrictions_early |  -.0500894   .0040777   -12.28   0.000    -.0580816   -.0420973
                    bank |  -12.41239   .8262302   -15.02   0.000    -14.03177   -10.79301
  bank_restriction_early |   .2071094   .0223102     9.28   0.000     .1633822    .2508367
                  capmkt |  -1.845002   .1945418    -9.48   0.000    -2.226297   -1.463707
capmkt_restriction_early |   .0800279   .0059669    13.41   0.000      .068333    .0917229
                      it |  -2.584032    .191735   -13.48   0.000    -2.959825   -2.208238
    it_restriction_early |   .0416959   .0047072     8.86   0.000       .03247    .0509217
                     pay |          0  (omitted)
   pay_restriction_early |          0  (omitted)
               vc_backed |    .811542   .4304149     1.89   0.059    -.0320556     1.65514
                  public |   .5074307   .1330458     3.81   0.000     .2466656    .7681957
            Sum2000FinVC |    .000172   .0002224     0.77   0.439    -.0002639     .000608
                   _cons |   1.005819     .17564     5.73   0.000     .6615706    1.350067
------------------------------------------------------------------------------------------
Note: 109 failures and 0 successes completely determined.

. local num_obs = _N

. local w_obs = e(N)

. local pR2 = e(r2_p)

. local WaldChi = e(chi2)

. local WaldChi_p = e(p)

. * Calculate margin effects
. margins, dydx(bank bank_restriction_early capmkt_restriction_early it_restriction_early pay_restriction_early) post

Average marginal effects                                 Number of obs = 2,554
Model VCE: Robust

Expression: Pr(switch_2), predict()
dy/dx wrt:  bank bank_restriction_early capmkt_restriction_early it_restriction_early pay_restriction_early

------------------------------------------------------------------------------------------
                         |            Delta-method
                         |      dy/dx   std. err.      z    P>|z|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
                    bank |  -2.379842   .1804598   -13.19   0.000    -2.733537   -2.026148
  bank_restriction_early |   .0397093   .0045488     8.73   0.000     .0307938    .0486249
capmkt_restriction_early |   .0153438   .0010523    14.58   0.000     .0132813    .0174064
    it_restriction_early |   .0079944    .000877     9.12   0.000     .0062755    .0097133
   pay_restriction_early |          0  (omitted)
------------------------------------------------------------------------------------------

. * Chi-square Test for marginal effects
. test bank_restriction_early == capmkt_restriction_early

 ( 1)  bank_restriction_early - capmkt_restriction_early = 0

           chi2(  1) =   27.46
         Prob > chi2 =    0.0000

. local C1 = r(chi2)

. test bank_restriction_early  == pay_restriction_early

 ( 1)  bank_restriction_early - o.pay_restriction_early = 0

           chi2(  1) =   76.21
         Prob > chi2 =    0.0000

. local C2 = r(chi2)

. test bank_restriction_early  == it_restriction_early

 ( 1)  bank_restriction_early - it_restriction_early = 0

           chi2(  1) =   52.85
         Prob > chi2 =    0.0000

. local C3 = r(chi2)

. 
. outreg2 using "../Charts/Table_11A_ShiftLocation_RegPressure.xls", append nocon label bracket se bdec(3) sdec(3) noobs
>  ///
>         keep(bank_restriction_early) ///
>         addtext(Assignee industry FEs, Yes, Assignee characteristics controls, Yes, Firm FEs, No, Patent Sample, All p
> atent) /// 
>         addstat(Number of Observations, `num_obs', Weighted Observations, `w_obs', Pseudo R-squared, `pR2', Chi-square
> d, `WaldChi', p-value, `WaldChi_p', Interaction with Other Finance vs. Bank, `C1', Interaction with Payments vs. Bank,
>  `C2', Interaction with IT/Other vs. Bank, `C3')
../Charts/Table_11A_ShiftLocation_RegPressure.xls
dir : seeout

. 
. 
. * Column 3 (use the sample for consumer-only patents)
. use "../data/finregswitch_csastate_pairs_company_level_consumer_only.dta", clear

. probit switch_2 restrictions_early bank bank_restriction_early capmkt capmkt_restriction_early it it_restriction_early
>  pay pay_restriction_early vc_backed public Sum2000FinVC company_name_id [weight=patcount_pre2008], vce(r)
(frequency weights assumed)

note: pay omitted because of collinearity.
note: pay_restriction_early omitted because of collinearity.
Iteration 0:   log pseudolikelihood =  -556.5596  
Iteration 1:   log pseudolikelihood = -257.79215  
Iteration 2:   log pseudolikelihood =  -240.7832  
Iteration 3:   log pseudolikelihood = -238.88096  
Iteration 4:   log pseudolikelihood = -238.66671  
Iteration 5:   log pseudolikelihood = -238.62942  
Iteration 6:   log pseudolikelihood = -238.62232  
Iteration 7:   log pseudolikelihood =  -238.6209  
Iteration 8:   log pseudolikelihood = -238.62058  
Iteration 9:   log pseudolikelihood = -238.62053  
Iteration 10:  log pseudolikelihood = -238.62052  

Probit regression                                     Number of obs =    1,115
                                                      Wald chi2(11) = 13528.48
                                                      Prob > chi2   =   0.0000
Log pseudolikelihood = -238.62052                     Pseudo R2     =   0.5713

------------------------------------------------------------------------------------------
                         |               Robust
                switch_2 | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
      restrictions_early |  -.0356553   .0063589    -5.61   0.000    -.0481186    -.023192
                    bank |  -10.30465   .2136203   -48.24   0.000    -10.72334   -9.885965
  bank_restriction_early |   .2733327   .0074083    36.90   0.000     .2588126    .2878528
                  capmkt |  -2.876375   .3411482    -8.43   0.000    -3.545013   -2.207737
capmkt_restriction_early |  -.0416937   .0117214    -3.56   0.000    -.0646672   -.0187203
                      it |  -4.589877   .3479315   -13.19   0.000     -5.27181   -3.907944
    it_restriction_early |   .0793158   .0089693     8.84   0.000     .0617364    .0968953
                     pay |          0  (omitted)
   pay_restriction_early |          0  (omitted)
               vc_backed |   .3121567   1.171669     0.27   0.790    -1.984272    2.608586
                  public |   .2781863   .6730354     0.41   0.679    -1.040939    1.597311
            Sum2000FinVC |  -.0012162   .0003014    -4.04   0.000    -.0018069   -.0006254
         company_name_id |   -.010517   .0048297    -2.18   0.029    -.0199831   -.0010509
                   _cons |    2.18164   .7174466     3.04   0.002     .7754707     3.58781
------------------------------------------------------------------------------------------
Note: 111 failures and 0 successes completely determined.

. local num_obs = _N

. local w_obs = e(N)

. local pR2 = e(r2_p)

. local WaldChi = e(chi2)

. local WaldChi_p = e(p)

. * Calculate margin effects
. margins, dydx(bank bank_restriction_early capmkt_restriction_early it_restriction_early pay_restriction_early) post

Average marginal effects                                 Number of obs = 1,115
Model VCE: Robust

Expression: Pr(switch_2), predict()
dy/dx wrt:  bank bank_restriction_early capmkt_restriction_early it_restriction_early pay_restriction_early

------------------------------------------------------------------------------------------
                         |            Delta-method
                         |      dy/dx   std. err.      z    P>|z|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
                    bank |  -1.236234   .0719466   -17.18   0.000    -1.377247   -1.095222
  bank_restriction_early |   .0327913   .0022226    14.75   0.000     .0284351    .0371475
capmkt_restriction_early |  -.0050019   .0015342    -3.26   0.001    -.0080089    -.001995
    it_restriction_early |   .0095154   .0009625     9.89   0.000      .007629    .0114018
   pay_restriction_early |          0  (omitted)
------------------------------------------------------------------------------------------

. * Chi-square Test for marginal effects
. test bank_restriction_early == capmkt_restriction_early

 ( 1)  bank_restriction_early - capmkt_restriction_early = 0

           chi2(  1) =  143.33
         Prob > chi2 =    0.0000

. local C1 = r(chi2)

. test bank_restriction_early  == pay_restriction_early

 ( 1)  bank_restriction_early - o.pay_restriction_early = 0

           chi2(  1) =  217.67
         Prob > chi2 =    0.0000

. local C2 = r(chi2)

. test bank_restriction_early  == it_restriction_early

 ( 1)  bank_restriction_early - it_restriction_early = 0

           chi2(  1) =  101.64
         Prob > chi2 =    0.0000

. local C3 = r(chi2)

. 
. outreg2 using "../Charts/Table_11A_ShiftLocation_RegPressure.xls", append nocon label bracket se bdec(3) sdec(3) noobs
>  ///
>         keep(bank_restriction_early) ///
>         addtext(Assignee industry FEs, Yes, Assignee characteristics controls, Yes, Firm FEs, Yes, Patent Sample, Cons
> umer-only) /// 
>         addstat(Number of Observations, `num_obs', Weighted Observations, `w_obs', Pseudo R-squared, `pR2', Chi-square
> d, `WaldChi', p-value, `WaldChi_p', Interaction with Other Finance vs. Bank, `C1', Interaction with Payments vs. Bank,
>  `C2', Interaction with IT/Other vs. Bank, `C3')
../Charts/Table_11A_ShiftLocation_RegPressure.xls
dir : seeout

. 
. 
. 
. 
. **** Shifting innovative location and technological positioning ****
. **** Table 11 Panel B ****
. 
. use ../data/financial_patent_data_v3.dta, clear

. clean_v3_7ind3app
(1,967 real changes made)
(1,862 real changes made)
(1,883 real changes made)
(22,654 missing values generated)
(1,618 real changes made)
(715 real changes made)
(1,098 real changes made)
(2,390 real changes made)
(9,057 real changes made)
(7,776 real changes made)
(22,654 missing values generated)
(3,431 real changes made)
(2,390 real changes made)
(16,833 real changes made)
(13,601 missing values generated)
(5,486 real changes made)
(9,924 real changes made)

. 
. gen app_period = 2008 if app_year >2004 & app_year <2009
(18,141 missing values generated)

. replace app_period = 2010 if app_year>2008 & app_year <2011
(3,194 real changes made)

. replace app_period = 2012 if app_year>2010 & app_year <2013
(3,863 real changes made)

. replace app_period = 2014 if app_year>2012 & app_year <2015
(3,274 real changes made)

. replace app_period = 2016 if app_year>2014 & app_year <2017
(1,985 real changes made)

. replace app_period = 2004 if app_year<2005
(5,317 real changes made)

. replace app_period = 2018 if app_year> 2016
(508 real changes made)

. 
. by company_name app_period, sort: egen modalcsa=mode(csa_code), max
Warning: at least one group contains all missing values or contains multiple modes.  Generating missing values for the
mode of these groups.  Use the missing, maxmode, minmode, or nummode() options to control this behavior.
(2,561 missing values generated)

. drop if missing(company_name)
(5,513 observations deleted)

. by company_name: egen first_patent_yr = min(app_year)

. by company_name: egen last_patent_yr = max(app_year)

. 
. collapse (count) patent_id (max) first_patent_yr last_patent_yr modalcsa, by(company_name indsimpletype app_period)

. keep if first_patent_yr <2005 & last_patent_yr >= 2016
(3,682 observations deleted)

. drop if app_period == 2018
(58 observations deleted)

. sort company_name app_period

. by company_name: gen year = app_period[_n+1]
(85 missing values generated)

. by company_name: gen late_modalcsa = modalcsa[_n+1]
(189 missing values generated)

. bysort company_name: gen cum_patent = sum(patent_id)

. drop if app_period >= 2016 | app_period == 2004
(162 observations deleted)

. bysort company_name: egen total_period = count(app_period)

. 
. keep if total_period == 4
(48 observations deleted)

. replace year = 2016 if missing(year)
(5 real changes made)

. gen switch = (modalcsa != late_modalcsa) & (modalcsa != . & late_modalcsa !=.)

. rename modalcsa csa_code

. 
. * get technology position index
. merge m:1 csa_code using ../data/csa_state_crosswalk.dta, keep(1 3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                            54
        from master                        54  (_merge==1)
        from using                          0  (_merge==2)

    Matched                               206  (_merge==3)
    -----------------------------------------

. drop _m

. merge m:1 state year using ../data/state_level_technology_science_index.dta, keep(1 3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                            65
        from master                        65  (_merge==1)
        from using                          0  (_merge==2)

    Matched                               195  (_merge==3)
    -----------------------------------------

. drop _m

. merge m:1 company_name using ../data/company_more_information.dta, keep(1 3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                               260  (_merge==3)
    -----------------------------------------

. drop _m

. 
. gen bank = (indsimpletype == 1)

. gen capmkt = (indsimpletype == 2)

. gen pay = (indsimpletype == 5)

. gen it = (indsimpletype == 6)

. 
. egen Overall_index_std = std(Overall_score)
(65 missing values generated)

. egen RDIC_index_std = std(RDIC_index)
(65 missing values generated)

. egen RCEIC_index_std = std(RCEIC_index)
(65 missing values generated)

. egen TCDC_index_std = std(TCDC_Index)
(65 missing values generated)

. egen TSWC_index_std = std(TSWC_index)
(65 missing values generated)

. egen HCIC_index_std = std(HCIC_index)
(65 missing values generated)

. 
. gen pay_Overall_index_std = pay#c.Overall_index_std
(65 missing values generated)

. gen capmkt_Overall_index_std = capmkt#c.Overall_index_std
(65 missing values generated)

. gen it_Overall_index_std = it#c.Overall_index_std
(65 missing values generated)

. gen bank_Overall_index_std = bank#c.Overall_index_std
(65 missing values generated)

. 
. gen pay_RDIC_index_std = pay#c.RDIC_index_std
(65 missing values generated)

. gen capmkt_RDIC_index_std = capmkt#c.RDIC_index_std
(65 missing values generated)

. gen it_RDIC_index_std = it#c.RDIC_index_std
(65 missing values generated)

. gen bank_RDIC_index_std = bank#c.RDIC_index_std
(65 missing values generated)

. 
. gen pay_RCEIC_index_std = pay#c.RCEIC_index_std
(65 missing values generated)

. gen capmkt_RCEIC_index_std = capmkt#c.RCEIC_index_std
(65 missing values generated)

. gen it_RCEIC_index_std = it#c.RCEIC_index_std
(65 missing values generated)

. gen bank_RCEIC_index_std = bank#c.RCEIC_index_std
(65 missing values generated)

. 
. gen pay_TCDC_index_std = pay#c.TCDC_index_std
(65 missing values generated)

. gen capmkt_TCDC_index_std = capmkt#c.TCDC_index_std
(65 missing values generated)

. gen it_TCDC_index_std = it#c.TCDC_index_std
(65 missing values generated)

. gen bank_TCDC_index_std = bank#c.TCDC_index_std
(65 missing values generated)

. 
. gen pay_TSWC_index_std = pay#c.TSWC_index_std
(65 missing values generated)

. gen capmkt_TSWC_index_std = capmkt#c.TSWC_index_std
(65 missing values generated)

. gen it_TSWC_index_std = it#c.TSWC_index_std
(65 missing values generated)

. gen bank_TSWC_index_std = bank#c.TSWC_index_std
(65 missing values generated)

. 
. gen pay_HCIC_index_std = pay#c.HCIC_index_std
(65 missing values generated)

. gen capmkt_HCIC_index_std = capmkt#c.HCIC_index_std
(65 missing values generated)

. gen it_HCIC_index_std = it#c.HCIC_index_std
(65 missing values generated)

. gen bank_HCIC_index_std = bank#c.HCIC_index_std
(65 missing values generated)

. 
. 
. 
. **** Regression for Table 11B ****
. 
. * Column 1
. probit switch Overall_index_std pay pay_Overall_index_std capmkt capmkt_Overall_index_std it it_Overall_index_std bank
>  bank_Overall_index_std public vc_backed Sum2000FinVC ///
> i.app_period [weight= cum_patent], vce(r)
(frequency weights assumed)

note: bank != 0 predicts failure perfectly;
      bank omitted and 16 obs not used.

note: vc_backed != 0 predicts failure perfectly;
      vc_backed omitted and 1 obs not used.

note: it omitted because of collinearity.
note: it_Overall_index_std omitted because of collinearity.
note: bank_Overall_index_std omitted because of collinearity.
Iteration 0:   log pseudolikelihood = -10120.166  
Iteration 1:   log pseudolikelihood = -7583.0138  
Iteration 2:   log pseudolikelihood = -7524.9698  
Iteration 3:   log pseudolikelihood = -7524.8217  
Iteration 4:   log pseudolikelihood = -7524.8217  

Probit regression                                      Number of obs =  18,421
                                                       Wald chi2(10) = 3783.46
                                                       Prob > chi2   =  0.0000
Log pseudolikelihood = -7524.8217                      Pseudo R2     =  0.2565

------------------------------------------------------------------------------------------
                         |               Robust
                  switch | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
       Overall_index_std |   .8526311       .029    29.40   0.000     .7957921    .9094701
                     pay |   1.018532   .0300393    33.91   0.000     .9596555    1.077408
   pay_Overall_index_std |  -1.343637   .0326759   -41.12   0.000    -1.407681   -1.279594
                  capmkt |  -.5949821   .0299761   -19.85   0.000    -.6537341   -.5362301
capmkt_Overall_index_std |  -.3859051   .0447702    -8.62   0.000     -.473653   -.2981572
                      it |          0  (omitted)
    it_Overall_index_std |          0  (omitted)
                    bank |          0  (omitted)
  bank_Overall_index_std |          0  (omitted)
                  public |   .5916723   .0359415    16.46   0.000     .5212283    .6621162
               vc_backed |          0  (omitted)
            Sum2000FinVC |  -.0020323   .0000488   -41.64   0.000     -.002128   -.0019367
                         |
              app_period |
                   2010  |  -1.305157   .0476454   -27.39   0.000     -1.39854   -1.211773
                   2012  |  -.5840134   .0341773   -17.09   0.000    -.6509996   -.5170272
                   2014  |  -.5855249   .0346478   -16.90   0.000    -.6534332   -.5176165
                         |
                   _cons |   .0229161    .044624     0.51   0.608    -.0645454    .1103776
------------------------------------------------------------------------------------------

. local num_obs = _N

. local w_obs = e(N)

. local pR2 = e(r2_p)

. local WaldChi = e(chi2)

. local WaldChi_p = e(p)

. * Calculate Marginal Effects
. margins, dydx(pay_Overall_index_std capmkt_Overall_index_std it_Overall_index_std bank_Overall_index_std) post

Average marginal effects                                Number of obs = 18,421
Model VCE: Robust

Expression: Pr(switch), predict()
dy/dx wrt:  pay_Overall_index_std capmkt_Overall_index_std it_Overall_index_std bank_Overall_index_std

------------------------------------------------------------------------------------------
                         |            Delta-method
                         |      dy/dx   std. err.      z    P>|z|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
   pay_Overall_index_std |  -.3065398   .0062448   -49.09   0.000    -.3187795   -.2943002
capmkt_Overall_index_std |  -.0880411    .010167    -8.66   0.000    -.1079681   -.0681141
    it_Overall_index_std |          0  (omitted)
  bank_Overall_index_std |          0  (omitted)
------------------------------------------------------------------------------------------

. test pay_Overall_index_std == capmkt_Overall_index_std

 ( 1)  pay_Overall_index_std - capmkt_Overall_index_std = 0

           chi2(  1) =  526.43
         Prob > chi2 =    0.0000

. local C1 = r(chi2)

. test pay_Overall_index_std == bank_Overall_index_std

 ( 1)  pay_Overall_index_std - o.bank_Overall_index_std = 0

           chi2(  1) = 2409.52
         Prob > chi2 =    0.0000

. local C2 = r(chi2)

. test pay_Overall_index_std == it_Overall_index_std 

 ( 1)  pay_Overall_index_std - o.it_Overall_index_std = 0

           chi2(  1) = 2409.52
         Prob > chi2 =    0.0000

. local C3 = r(chi2)

. 
. outreg2 using "../Charts/Table_11B_ShiftLocation_TechIndex.xls", replace nocon label bracket se bdec(3) sdec(3) noobs 
> ///
>         keep(pay_Overall_index_std) ///
>         addtext(Assignee industry FEs, Yes, Assignee characteristics controls, Yes, Firm FEs, Yes) /// 
>         addstat(Number of Observations, `num_obs', Weighted Observations, `w_obs', Pseudo R-squared, `pR2', Chi-square
> d, `WaldChi', p-value, `WaldChi_p', Interaction with Other Finance vs. Payments , `C1', Interaction with Bank vs. Paym
> ents, `C2', Interaction with IT/Other vs. Payments, `C3')
../Charts/Table_11B_ShiftLocation_TechIndex.xls
dir : seeout

. 
. 
. * Column 2
. probit switch RDIC_index_std pay pay_RDIC_index_std capmkt capmkt_RDIC_index_std it it_RDIC_index_std bank bank_RDIC_i
> ndex_std public vc_backed Sum2000FinVC ///
> i.app_period [weight= cum_patent], vce(r)
(frequency weights assumed)

note: bank != 0 predicts failure perfectly;
      bank omitted and 16 obs not used.

note: vc_backed != 0 predicts failure perfectly;
      vc_backed omitted and 1 obs not used.

note: it omitted because of collinearity.
note: it_RDIC_index_std omitted because of collinearity.
note: bank_RDIC_index_std omitted because of collinearity.
Iteration 0:   log pseudolikelihood = -10120.166  
Iteration 1:   log pseudolikelihood = -8076.2007  
Iteration 2:   log pseudolikelihood = -8040.6301  
Iteration 3:   log pseudolikelihood = -8040.5094  
Iteration 4:   log pseudolikelihood = -8040.5094  

Probit regression                                      Number of obs =  18,421
                                                       Wald chi2(10) = 3466.37
                                                       Prob > chi2   =  0.0000
Log pseudolikelihood = -8040.5094                      Pseudo R2     =  0.2055

---------------------------------------------------------------------------------------
                      |               Robust
               switch | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
----------------------+----------------------------------------------------------------
       RDIC_index_std |     .67405   .0241831    27.87   0.000     .6266521     .721448
                  pay |   .9924413   .0301072    32.96   0.000     .9334324     1.05145
   pay_RDIC_index_std |  -.9603189   .0268185   -35.81   0.000    -1.012882   -.9077556
               capmkt |  -.5807219   .0324115   -17.92   0.000    -.6442472   -.5171966
capmkt_RDIC_index_std |   -.090382   .0469246    -1.93   0.054    -.1823525    .0015886
                   it |          0  (omitted)
    it_RDIC_index_std |          0  (omitted)
                 bank |          0  (omitted)
  bank_RDIC_index_std |          0  (omitted)
               public |    .686655   .0362012    18.97   0.000     .6157019    .7576081
            vc_backed |          0  (omitted)
         Sum2000FinVC |  -.0017715   .0000425   -41.69   0.000    -.0018548   -.0016882
                      |
           app_period |
                2010  |  -1.012572   .0421613   -24.02   0.000    -1.095207   -.9299378
                2012  |  -.4099768   .0339445   -12.08   0.000    -.4765068   -.3434468
                2014  |  -.5455329    .033704   -16.19   0.000    -.6115916   -.4794742
                      |
                _cons |  -.2908162   .0405905    -7.16   0.000    -.3703721   -.2112604
---------------------------------------------------------------------------------------

. local num_obs = _N

. local w_obs = e(N)

. local pR2 = e(r2_p)

. local WaldChi = e(chi2)

. local WaldChi_p = e(p)

. * Calculate Marginal Effects
. margins, dydx(pay_RDIC_index_std capmkt_RDIC_index_std it_RDIC_index_std bank_RDIC_index_std) post

Average marginal effects                                Number of obs = 18,421
Model VCE: Robust

Expression: Pr(switch), predict()
dy/dx wrt:  pay_RDIC_index_std capmkt_RDIC_index_std it_RDIC_index_std bank_RDIC_index_std

---------------------------------------------------------------------------------------
                      |            Delta-method
                      |      dy/dx   std. err.      z    P>|z|     [95% conf. interval]
----------------------+----------------------------------------------------------------
   pay_RDIC_index_std |  -.2341036   .0060436   -38.74   0.000    -.2459488   -.2222584
capmkt_RDIC_index_std |   -.022033   .0114787    -1.92   0.055    -.0445308    .0004647
    it_RDIC_index_std |          0  (omitted)
  bank_RDIC_index_std |          0  (omitted)
---------------------------------------------------------------------------------------

. test pay_RDIC_index_std == capmkt_RDIC_index_std

 ( 1)  pay_RDIC_index_std - capmkt_RDIC_index_std = 0

           chi2(  1) =  367.82
         Prob > chi2 =    0.0000

. local C1 = r(chi2)

. test pay_RDIC_index_std == bank_RDIC_index_std

 ( 1)  pay_RDIC_index_std - o.bank_RDIC_index_std = 0

           chi2(  1) = 1500.47
         Prob > chi2 =    0.0000

. local C2 = r(chi2)

. test pay_RDIC_index_std == it_RDIC_index_std

 ( 1)  pay_RDIC_index_std - o.it_RDIC_index_std = 0

           chi2(  1) = 1500.47
         Prob > chi2 =    0.0000

. local C3 = r(chi2)

. 
. 
. outreg2 using "../Charts/Table_11B_ShiftLocation_TechIndex.xls", append nocon label bracket se bdec(3) sdec(3) noobs /
> //
>         keep(pay_RDIC_index_std) ///
>         addtext(Assignee industry FEs, Yes, Assignee characteristics controls, Yes, Firm FEs, Yes) /// 
>         addstat(Number of Observations, `num_obs', Weighted Observations, `w_obs', Pseudo R-squared, `pR2', Chi-square
> d, `WaldChi', p-value, `WaldChi_p', Interaction with Other Finance vs. Payments , `C1', Interaction with Bank vs. Paym
> ents, `C2', Interaction with IT/Other vs. Payments, `C3')
../Charts/Table_11B_ShiftLocation_TechIndex.xls
dir : seeout

. 
. 
. 
. 
. 
. 
. 
. 
. 
. *****************************************************************************************
. ** Technological positioning on financial patenting (Table 10, Table A-15, Figure A-9) **
. *****************************************************************************************
. 
. use ../data/financial_patent_data_v3.dta, clear

. clean_v3_7ind3app
(1,967 real changes made)
(1,862 real changes made)
(1,883 real changes made)
(22,654 missing values generated)
(1,618 real changes made)
(715 real changes made)
(1,098 real changes made)
(2,390 real changes made)
(9,057 real changes made)
(7,776 real changes made)
(22,654 missing values generated)
(3,431 real changes made)
(2,390 real changes made)
(16,833 real changes made)
(13,601 missing values generated)
(5,486 real changes made)
(9,924 real changes made)

. 
. collapse (count) patent (sum) cite_count weighted_cite, by(state app_year indsimpletype apptype)

. drop if missing(state)
(182 observations deleted)

. 
. preserve

. collapse (count) app_year, by(state)

. drop app_year

. expand 4
(159 observations created)

. bysort state: gen indsimpletype = _n

. replace indsimpletype = indsimpletype + 2 if indsimpletype >=3
(106 real changes made)

. label values indsimpletype indsimpletype1

. expand 3
(424 observations created)

. bysort state indsimpletype: gen apptype = _n

. label values apptype apptype1

. expand 19
(11,448 observations created)

. bysort state indsimpletype apptype: gen app_year = _n+1999

. tempfile stata_ind_app_ayear_expandcells

. save `stata_ind_app_ayear_expandcells'
file /var/folders/y0/7tm8swhj7q9bm8t8f8q4g_gr0000gq/T//S_52133.00000d saved as .dta format

. restore

. 
. merge 1:1 state app_year apptype indsimpletype using `stata_ind_app_ayear_expandcells'
(label indsimpletype1 already defined)
(label apptype1 already defined)

    Result                      Number of obs
    -----------------------------------------
    Not matched                         8,601
        from master                         0  (_merge==1)
        from using                      8,601  (_merge==2)

    Matched                             3,483  (_merge==3)
    -----------------------------------------

. drop _m

. replace patent_id = 0 if missing(patent_id)
(8,601 real changes made)

. rename patent_id patcount

. gen average_cite = cite_count/patcount
(8,601 missing values generated)

. replace average_cite = 0 if missing(average_cite)
(8,601 real changes made)

. 
. rename app_year year

. merge m:1 state year using "../data/state_level_technology_science_index.dta", keep(3)

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                            10,800  (_merge==3)
    -----------------------------------------

. drop _m

. save "../data/state_indtype_apptype_appyear_with_techindex_cells.dta", replace
file ../data/state_indtype_apptype_appyear_with_techindex_cells.dta saved

. 
. 
. ***** Regression for  Table 10 ****
. use ../data/state_indtype_apptype_appyear_with_techindex_cells.dta, clear

. 
. 
. * Column 1
. reghdfe patcount c.Overall_score##(b1.indsimpletype b2.apptype) if year >= 2008, a(year state_fips) vce(cluster state_
> fips#year)
(MWFE estimator converged in 2 iterations)

HDFE Linear regression                            Number of obs   =      6,600
Absorbing 2 HDFE groups                           F(  11,    549) =      21.51
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.3915
                                                  Adj R-squared   =     0.3850
                                                  Within R-sq.    =     0.1317
Number of clusters (state_fips#year) =        550 Root MSE        =     5.2099

                                       (Std. err. adjusted for 550 clusters in state_fips#year)
-----------------------------------------------------------------------------------------------
                              |               Robust
                     patcount | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
------------------------------+----------------------------------------------------------------
                Overall_score |  -.2011265   .0425658    -4.73   0.000    -.2847383   -.1175148
                              |
                indsimpletype |
               Other Finance  |  -1.361599    .273572    -4.98   0.000    -1.898975   -.8242229
                    Payments  |  -2.273075   .7348652    -3.09   0.002    -3.716567   -.8295832
                IT and Other  |  -7.632891   1.773527    -4.30   0.000    -11.11662   -4.149161
                              |
                      apptype |
                    payments  |  -2.462814   .6126775    -4.02   0.000    -3.666293   -1.259335
                    otherapp  |  -2.538873    .601625    -4.22   0.000    -3.720642   -1.357105
                              |
indsimpletype#c.Overall_score |
               Other Finance  |   .0361223    .007217     5.01   0.000      .021946    .0502985
                    Payments  |   .0482797   .0169345     2.85   0.005     .0150153     .081544
                IT and Other  |   .2159382   .0408317     5.29   0.000     .1357327    .2961437
                              |
      apptype#c.Overall_score |
                    payments  |   .0634492   .0141114     4.50   0.000     .0357302    .0911682
                    otherapp  |   .0651749   .0138281     4.71   0.000     .0380124    .0923373
                              |
                        _cons |   10.58957   2.088489     5.07   0.000     6.487165    14.69198
-----------------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |        11           0          11     |
  state_fips |        50           1          49     |
-----------------------------------------------------+

. add_year

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |      6,600        2013    3.162517       2008       2018

added scalar:
           e(min_year) =  2008

added scalar:
           e(max_year) =  2018

. 
. * F-test for coefficients equality
. test c.Overall_score#5.indsimpletype == c.Overall_score#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.Overall_score + 5.indsimpletype#c.Overall_score = 0

       F(  1,   549) =    8.13
            Prob > F =    0.0045

. local F1 = r(F)

. test c.Overall_score#6.indsimpletype == c.Overall_score#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.Overall_score + 6.indsimpletype#c.Overall_score = 0

       F(  1,   549) =   27.97
            Prob > F =    0.0000

. local F2 = r(F)

. test c.Overall_score#1.apptype == c.Overall_score#2.apptype

 ( 1)  1.apptype#c.Overall_score - 2b.apptype#co.Overall_score = 0

       F(  1,   549) =   20.22
            Prob > F =    0.0000

. local F3 = r(F)

. test c.Overall_score#3.apptype == c.Overall_score#2.apptype

 ( 1)  - 2b.apptype#co.Overall_score + 3.apptype#c.Overall_score = 0

       F(  1,   549) =   22.21
            Prob > F =    0.0000

. local F4 = r(F)

. 
. outreg2 using "../Charts/Table_10_TechIndex.xls", replace nocon label bracket se bdec(3) sdec(3)  ///
>         keep(c.Overall_score#6.indsimpletype c.Overall_score#5.indsimpletype c.Overall_score#1.apptype c.Overall_score
> #3.apptype) ///
>         addtext(Time FEs, Yes, State FEs, Yes, PatentType FEs, Yes, AssigneeIndustry FEs, Yes, Sample, `e(min_year)'-`
> e(max_year)') ///
>         addstat(Interaction with Payments vs. Bank, `F1', Interaction with IT/Other vs. Bank, `F2', Interaction with P
> ayment vs. Banking Type, `F3', Interaction with Other vs. Banking Type, `F4')
../Charts/Table_10_TechIndex.xls
dir : seeout

. 
. 
. * Column 2
. reghdfe patcount c.RDIC_index##(b1.indsimpletype b2.apptype) if year >= 2008, a(year state_fips) vce(cluster state_fip
> s#year)
(MWFE estimator converged in 2 iterations)

HDFE Linear regression                            Number of obs   =      6,600
Absorbing 2 HDFE groups                           F(  11,    549) =      20.80
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.3765
                                                  Adj R-squared   =     0.3699
                                                  Within R-sq.    =     0.1103
Number of clusters (state_fips#year) =        550 Root MSE        =     5.2734

                                    (Std. err. adjusted for 550 clusters in state_fips#year)
--------------------------------------------------------------------------------------------
                           |               Robust
                  patcount | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
---------------------------+----------------------------------------------------------------
                RDIC_index |  -.0975513   .0193515    -5.04   0.000    -.1355633   -.0595393
                           |
             indsimpletype |
            Other Finance  |  -.5263667   .1899516    -2.77   0.006    -.8994875   -.1532459
                 Payments  |  -1.434074    .437328    -3.28   0.001    -2.293115    -.575033
             IT and Other  |  -3.047699   1.071719    -2.84   0.005     -5.15287   -.9425286
                           |
                   apptype |
                 payments  |  -1.197508    .369465    -3.24   0.001    -1.923245   -.4717696
                 otherapp  |  -1.295764    .363944    -3.56   0.000    -2.010657   -.5808709
                           |
indsimpletype#c.RDIC_index |
            Other Finance  |   .0203362   .0048824     4.17   0.000     .0107458    .0299267
                 Payments  |   .0325428   .0112503     2.89   0.004     .0104439    .0546417
             IT and Other  |   .1294542   .0275231     4.70   0.000     .0753907    .1835178
                           |
      apptype#c.RDIC_index |
                 payments  |   .0396223   .0095049     4.17   0.000     .0209519    .0582926
                 otherapp  |   .0417944   .0093115     4.49   0.000     .0235038     .060085
                           |
                     _cons |   5.128083   .8816999     5.82   0.000     3.396165    6.860002
--------------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |        11           0          11     |
  state_fips |        50           1          49     |
-----------------------------------------------------+

. add_year

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |      6,600        2013    3.162517       2008       2018

added scalar:
           e(min_year) =  2008

added scalar:
           e(max_year) =  2018

. * F-test for coefficients equality
. test c.RDIC_index#5.indsimpletype == c.RDIC_index#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.RDIC_index + 5.indsimpletype#c.RDIC_index = 0

       F(  1,   549) =    8.37
            Prob > F =    0.0040

. local F1 = r(F)

. test c.RDIC_index#6.indsimpletype == c.RDIC_index#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.RDIC_index + 6.indsimpletype#c.RDIC_index = 0

       F(  1,   549) =   22.12
            Prob > F =    0.0000

. local F2 = r(F)

. test c.RDIC_index#1.apptype == c.RDIC_index#2.apptype

 ( 1)  1.apptype#c.RDIC_index - 2b.apptype#co.RDIC_index = 0

       F(  1,   549) =   17.38
            Prob > F =    0.0000

. local F3 = r(F)

. test c.RDIC_index#3.apptype == c.RDIC_index#2.apptype

 ( 1)  - 2b.apptype#co.RDIC_index + 3.apptype#c.RDIC_index = 0

       F(  1,   549) =   20.15
            Prob > F =    0.0000

. local F4 = r(F)

. 
. outreg2 using "../Charts/Table_10_TechIndex.xls", append nocon label bracket se bdec(3) sdec(3)  ///
>         keep(c.RDIC_index#6.indsimpletype c.RDIC_index#5.indsimpletype c.RDIC_index#1.apptype c.RDIC_index#3.apptype) 
> ///
>         addtext(Time FEs, Yes, State FEs, Yes, PatentType FEs, Yes, AssigneeIndustry FEs, Yes, Sample, `e(min_year)'-`
> e(max_year)') ///
>         addstat(Interaction with Payments vs. Bank, `F1', Interaction with IT/Other vs. Bank, `F2', Interaction with P
> ayment vs. Banking Type, `F3', Interaction with Other vs. Banking Type, `F4')
../Charts/Table_10_TechIndex.xls
dir : seeout

. 
. 
. 
. ***** Regression for Table A-15 *****
. use ../data/state_indtype_apptype_appyear_with_techindex_cells.dta, clear

. 
. * Column 1
. reghdfe patcount c.TCDC_Index##(b1.indsimpletype b2.apptype) if year >= 2008, a(year state_fips) vce(cluster state_fip
> s#year)
(MWFE estimator converged in 2 iterations)

HDFE Linear regression                            Number of obs   =      6,600
Absorbing 2 HDFE groups                           F(  11,    549) =      20.48
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.3945
                                                  Adj R-squared   =     0.3880
                                                  Within R-sq.    =     0.1360
Number of clusters (state_fips#year) =        550 Root MSE        =     5.1969

                                    (Std. err. adjusted for 550 clusters in state_fips#year)
--------------------------------------------------------------------------------------------
                           |               Robust
                  patcount | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
---------------------------+----------------------------------------------------------------
                TCDC_Index |  -.1442247   .0244661    -5.89   0.000    -.1922833   -.0961662
                           |
             indsimpletype |
            Other Finance  |  -.5549892   .2215179    -2.51   0.013    -.9901156   -.1198628
                 Payments  |  -1.761391   .6139302    -2.87   0.004    -2.967331   -.5554517
             IT and Other  |  -5.727829   1.475903    -3.88   0.000    -8.626936   -2.828721
                           |
                   apptype |
                 payments  |  -2.127908   .5006956    -4.25   0.000    -3.111422   -1.144394
                 otherapp  |  -2.358893   .4972082    -4.74   0.000    -3.335556   -1.382229
                           |
indsimpletype#c.TCDC_Index |
            Other Finance  |   .0206497   .0058513     3.53   0.000     .0091561    .0321433
                 Payments  |   .0384248   .0146322     2.63   0.009     .0096829    .0671667
             IT and Other  |   .1791907    .034793     5.15   0.000     .1108471    .2475343
                           |
      apptype#c.TCDC_Index |
                 payments  |   .0569492   .0118593     4.80   0.000      .033654    .0802444
                 otherapp  |   .0616332   .0117098     5.26   0.000     .0386316    .0846348
                           |
                     _cons |   7.628776   1.114129     6.85   0.000     5.440298    9.817254
--------------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |        11           0          11     |
  state_fips |        50           1          49     |
-----------------------------------------------------+

. add_year

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |      6,600        2013    3.162517       2008       2018

added scalar:
           e(min_year) =  2008

added scalar:
           e(max_year) =  2018

. * F-test for coefficients equality
. test c.TCDC_Index#5.indsimpletype == c.TCDC_Index#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.TCDC_Index + 5.indsimpletype#c.TCDC_Index = 0

       F(  1,   549) =    6.90
            Prob > F =    0.0089

. local F1 = r(F)

. test c.TCDC_Index#6.indsimpletype == c.TCDC_Index#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.TCDC_Index + 6.indsimpletype#c.TCDC_Index = 0

       F(  1,   549) =   26.52
            Prob > F =    0.0000

. local F2 = r(F)

. 
. outreg2 using "../Charts/Table_A15_TechIndex.xls", replace nocon label bracket se bdec(3) sdec(3)  ///
>         keep(c.TCDC_Index#6.indsimpletype c.TCDC_Index#5.indsimpletype) ///
>         addtext(Time FEs, Yes, State FEs, Yes, PatentType FEs, Yes, AssigneeIndustry FEs, Yes, Sample, `e(min_year)'-`
> e(max_year)') addstat(Interaction with Payments vs. Bank, `F1', Interaction with IT/Other vs. Bank, `F2')
../Charts/Table_A15_TechIndex.xls
dir : seeout

. 
. 
. * Column 2
. reghdfe patcount c.RCEIC_index##(b1.indsimpletype b2.apptype) if year >= 2008, a(year state_fips) vce(cluster state_fi
> ps#year)
(MWFE estimator converged in 2 iterations)

HDFE Linear regression                            Number of obs   =      6,600
Absorbing 2 HDFE groups                           F(  11,    549) =      20.74
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.4016
                                                  Adj R-squared   =     0.3952
                                                  Within R-sq.    =     0.1461
Number of clusters (state_fips#year) =        550 Root MSE        =     5.1662

                                     (Std. err. adjusted for 550 clusters in state_fips#year)
---------------------------------------------------------------------------------------------
                            |               Robust
                   patcount | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
----------------------------+----------------------------------------------------------------
                RCEIC_index |  -.1380701   .0252906    -5.46   0.000    -.1877483    -.088392
                            |
              indsimpletype |
             Other Finance  |  -1.690075    .380083    -4.45   0.000     -2.43667   -.9434801
                  Payments  |  -2.168604    .756104    -2.87   0.004    -3.653814   -.6833927
              IT and Other  |  -8.829639   1.793569    -4.92   0.000    -12.35274   -5.306542
                            |
                    apptype |
                  payments  |   -2.47013   .6323221    -3.91   0.000    -3.712197   -1.228064
                  otherapp  |  -2.614863   .6097975    -4.29   0.000    -3.812685   -1.417041
                            |
indsimpletype#c.RCEIC_index |
             Other Finance  |   .0426578     .00946     4.51   0.000     .0240756      .06124
                  Payments  |   .0465503   .0174506     2.67   0.008     .0122721    .0808284
              IT and Other  |   .2402421   .0412352     5.83   0.000     .1592439    .3212402
                            |
      apptype#c.RCEIC_index |
                  payments  |   .0639608    .014536     4.40   0.000     .0354077    .0925139
                  otherapp  |   .0670188   .0140606     4.77   0.000     .0393996    .0946379
                            |
                      _cons |   7.253562    1.14224     6.35   0.000     5.009867    9.497257
---------------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |        11           0          11     |
  state_fips |        50           1          49     |
-----------------------------------------------------+

. add_year

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |      6,600        2013    3.162517       2008       2018

added scalar:
           e(min_year) =  2008

added scalar:
           e(max_year) =  2018

. * F-test for coefficients equality
. test c.RCEIC_index#5.indsimpletype == c.RCEIC_index#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.RCEIC_index + 5.indsimpletype#c.RCEIC_index = 0

       F(  1,   549) =    7.12
            Prob > F =    0.0079

. local F1 = r(F)

. test c.RCEIC_index#6.indsimpletype == c.RCEIC_index#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.RCEIC_index + 6.indsimpletype#c.RCEIC_index = 0

       F(  1,   549) =   33.94
            Prob > F =    0.0000

. local F2 = r(F)

. 
. outreg2 using "../Charts/Table_A15_TechIndex.xls", append nocon label bracket se bdec(3) sdec(3)  ///
>         keep(c.RCEIC_index#6.indsimpletype c.RCEIC_index#5.indsimpletype) ///
>         addtext(Time FEs, Yes, State FEs, Yes, PatentType FEs, Yes, AssigneeIndustry FEs, Yes, Sample, `e(min_year)'-`
> e(max_year)') addstat(Interaction with Payments vs. Bank, `F1', Interaction with IT/Other vs. Bank, `F2')
../Charts/Table_A15_TechIndex.xls
dir : seeout

. 
. 
. * Column 3
. reghdfe patcount c.TSWC_index##(b1.indsimpletype b2.apptype) if year >= 2008, a(year state_fips) vce(cluster state_fip
> s#year)
(MWFE estimator converged in 2 iterations)

HDFE Linear regression                            Number of obs   =      6,600
Absorbing 2 HDFE groups                           F(  11,    549) =      19.66
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.3897
                                                  Adj R-squared   =     0.3832
                                                  Within R-sq.    =     0.1291
Number of clusters (state_fips#year) =        550 Root MSE        =     5.2175

                                    (Std. err. adjusted for 550 clusters in state_fips#year)
--------------------------------------------------------------------------------------------
                           |               Robust
                  patcount | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
---------------------------+----------------------------------------------------------------
                TSWC_index |  -.0551126   .0193553    -2.85   0.005    -.0931322    -.017093
                           |
             indsimpletype |
            Other Finance  |  -.8880669   .2576046    -3.45   0.001    -1.394078   -.3820556
                 Payments  |   -1.61169   .6044803    -2.67   0.008    -2.799067   -.4243124
             IT and Other  |  -5.853904   1.479854    -3.96   0.000    -8.760772   -2.947036
                           |
                   apptype |
                 payments  |  -2.000002   .5058471    -3.95   0.000    -2.993634   -1.006369
                 otherapp  |  -1.764567   .4995992    -3.53   0.000    -2.745926   -.7832067
                           |
indsimpletype#c.TSWC_index |
            Other Finance  |   .0265652   .0060509     4.39   0.000     .0146794     .038451
                 Payments  |   .0349708   .0140881     2.48   0.013     .0072976     .062644
             IT and Other  |   .1785729   .0343121     5.20   0.000     .1111738     .245972
                           |
      apptype#c.TSWC_index |
                 payments  |    .053596   .0117878     4.55   0.000     .0304412    .0767508
                 otherapp  |   .0494362   .0115787     4.27   0.000     .0266922    .0721801
                           |
                     _cons |   3.015091   .9122313     3.31   0.001     1.223201    4.806982
--------------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |        11           0          11     |
  state_fips |        50           1          49     |
-----------------------------------------------------+

. add_year

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |      6,600        2013    3.162517       2008       2018

added scalar:
           e(min_year) =  2008

added scalar:
           e(max_year) =  2018

. * F-test for coefficients equality
. test c.TSWC_index#5.indsimpletype == c.TSWC_index#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.TSWC_index + 5.indsimpletype#c.TSWC_index = 0

       F(  1,   549) =    6.16
            Prob > F =    0.0134

. local F1 = r(F)

. test c.TSWC_index#6.indsimpletype == c.TSWC_index#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.TSWC_index + 6.indsimpletype#c.TSWC_index = 0

       F(  1,   549) =   27.09
            Prob > F =    0.0000

. local F2 = r(F)

. 
. outreg2 using "../Charts/Table_A15_TechIndex.xls", append nocon label bracket se bdec(3) sdec(3)  ///
>         keep(c.TSWC_index#6.indsimpletype c.TSWC_index#5.indsimpletype) ///
>         addtext(Time FEs, Yes, State FEs, Yes, PatentType FEs, Yes, AssigneeIndustry FEs, Yes, Sample, `e(min_year)'-`
> e(max_year)') addstat(Interaction with Payments vs. Bank, `F1', Interaction with IT/Other vs. Bank, `F2')
../Charts/Table_A15_TechIndex.xls
dir : seeout

. 
. 
. * Column 4
. reghdfe patcount c.HCIC_index##(b1.indsimpletype b2.apptype) if year >= 2008, a(year state_fips) vce(cluster state_fip
> s#year)
(MWFE estimator converged in 2 iterations)

HDFE Linear regression                            Number of obs   =      6,600
Absorbing 2 HDFE groups                           F(  11,    549) =      17.66
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.3621
                                                  Adj R-squared   =     0.3553
                                                  Within R-sq.    =     0.0898
Number of clusters (state_fips#year) =        550 Root MSE        =     5.3340

                                    (Std. err. adjusted for 550 clusters in state_fips#year)
--------------------------------------------------------------------------------------------
                           |               Robust
                  patcount | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
---------------------------+----------------------------------------------------------------
                HCIC_index |  -.1439787   .0270598    -5.32   0.000    -.1971321   -.0908253
                           |
             indsimpletype |
            Other Finance  |   -1.20032   .3907377    -3.07   0.002    -1.967844   -.4327964
                 Payments  |  -1.376215   .3376422    -4.08   0.000    -2.039443   -.7129858
             IT and Other  |   -1.89588   .9111383    -2.08   0.038    -3.685624    -.106136
                           |
                   apptype |
                 payments  |   -.614492   .2888469    -2.13   0.034    -1.181872   -.0471116
                 otherapp  |  -.5877907   .2948347    -1.99   0.047    -1.166933   -.0086486
                           |
indsimpletype#c.HCIC_index |
            Other Finance  |   .0337839   .0083763     4.03   0.000     .0173304    .0502374
                 Payments  |   .0318171   .0090972     3.50   0.001     .0139476    .0496867
             IT and Other  |    .108525   .0237583     4.57   0.000     .0618568    .1551933
                           |
      apptype#c.HCIC_index |
                 payments  |   .0287046   .0079391     3.62   0.000     .0131098    .0442994
                 otherapp  |   .0284577   .0079787     3.57   0.000     .0127853    .0441302
                           |
                     _cons |   7.437407   1.265976     5.87   0.000     4.950658    9.924157
--------------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
        year |        11           0          11     |
  state_fips |        50           1          49     |
-----------------------------------------------------+

. add_year

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
        year |      6,600        2013    3.162517       2008       2018

added scalar:
           e(min_year) =  2008

added scalar:
           e(max_year) =  2018

. * F-test for coefficients equality
. test c.HCIC_index#5.indsimpletype == c.HCIC_index#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.HCIC_index + 5.indsimpletype#c.HCIC_index = 0

       F(  1,   549) =   12.23
            Prob > F =    0.0005

. local F1 = r(F)

. test c.HCIC_index#6.indsimpletype == c.HCIC_index#1.indsimpletype

 ( 1)  - 1b.indsimpletype#co.HCIC_index + 6.indsimpletype#c.HCIC_index = 0

       F(  1,   549) =   20.87
            Prob > F =    0.0000

. local F2 = r(F)

. 
. outreg2 using "../Charts/Table_A15_TechIndex.xls", append nocon label bracket se bdec(3) sdec(3)  ///
>         keep(c.HCIC_index#6.indsimpletype c.HCIC_index#5.indsimpletype) ///
>         addtext(Time FEs, Yes, State FEs, Yes, PatentType FEs, Yes, AssigneeIndustry FEs, Yes, Sample, `e(min_year)'-`
> e(max_year)') addstat(Interaction with Payments vs. Bank, `F1', Interaction with IT/Other vs. Bank, `F2')
../Charts/Table_A15_TechIndex.xls
dir : seeout

. 
. 
. 
. **** Figure A-9 ****
. use ../data/state_indtype_apptype_appyear_with_techindex_cells.dta, clear

. preserve

. 
. keep if year >= 2008
(4,200 observations deleted)

. collapse (sum) patcount (min) Overall_score RDIC_index, by(state year indsimpletype)

. reshape wide patcount, i(state year) j(indsimpletype)
(j = 1 2 5 6)

Data                               Long   ->   Wide
-----------------------------------------------------------------------------
Number of observations            2,200   ->   550         
Number of variables                   6   ->   8           
j variable (4 values)     indsimpletype   ->   (dropped)
xij variables:
                               patcount   ->   patcount1 patcount2 ... patcount6
-----------------------------------------------------------------------------

. collapse (sum) patcount* (mean) Overall_score RDIC_index, by(state)

. gen patent_total = patcount1+ patcount2 + patcount5 + patcount6

. gen share_pay = patcount5/patent_total

. 
. * Figure A-9 Panel A
. graph twoway (lfitci share_pay Overall_score if share_pay != 0 [weight = patent_total], clc(red) leg(off)) (scatter sh
> are_pay Overall_score if share_pay != 0, mc(navy)), ///
> xtitle("State-level Average Technology Positioning between 2008 and 2018", size(small)) xlabel(30(10)80,labsize(small)
> ) ///
> ytitle("Share of Finance Patents by Payment Firms", size(small)) ylabel(,labsize(small)) note("Note: The technology po
> sitioning in a given state is measured by the overall technology and science index from the State Technology" "and Sci
> ence Index (STSI) data provided by Milken Institute.", size(vsmall)) ///
> graphregion(color(white))
(analytic weights assumed)

. graph export "../Charts/Figure_A9A.png", replace
file /Users/gxzheng/Desktop/fintech/code/../Charts/Figure_A9A.png saved as PNG format

. 
. * Figure A-9 Panel B
. graph twoway (lfitci share_pay  RDIC_index if share_pay != 0 [weight = patent_total], clc(red) leg(off)) (scatter shar
> e_pay RDIC_index if share_pay != 0, mc(navy)), ///
> xtitle("State-level Average Technology Positioning between 2008 and 2018", size(small)) xlabel(,labsize(small)) ///
> ytitle("Share of Finance Patents by Payment Firms", size(small)) ylabel(,labsize(small)) note("Note: The technology po
> sitioning in a given state is measured by the index of research & development input from the State Technology" "and Sc
> ience Index (STSI) data provided by Milken Institute.", size(vsmall)) ///
> graphregion(color(white))
(analytic weights assumed)

. graph export "../Charts/Figure_A9B.png", replace
file /Users/gxzheng/Desktop/fintech/code/../Charts/Figure_A9B.png saved as PNG format

. 
. restore

. 
. 
. 
. log close
      name:  <unnamed>
       log:  /Users/gxzheng/Desktop/fintech/code/../log/finreg_quantgov+stsi.log
  log type:  text
 closed on:  19 May 2023, 14:59:37
------------------------------------------------------------------------------------------------------------------------
